introduction to computers and java n.
Download
Skip this Video
Download Presentation
CS 401

Loading in 2 Seconds...

play fullscreen
1 / 15

CS 401 - PowerPoint PPT Presentation


  • 81 Views
  • Uploaded on

Introduction to Computers and Java. CS 401. Why Program?. Computers are tools that can be programmed to perform many functions, such as: Spreadsheets Word Processors Databases Games Computers are very good at tedious, repetitive tasks. C++ C# Java JavaScript Perl PHP Python

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CS 401' - wyatt-castro


Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
why program
Why Program?
  • Computers are tools that can be programmed to perform many functions, such as:
    • Spreadsheets
    • Word Processors
    • Databases
    • Games
  • Computers are very good at tedious, repetitive tasks
programming languages
C++

C#

Java

JavaScript

Perl

PHP

Python

Visual Basic

Programming Languages
  • Ada
  • BASH
  • BASIC
  • C
  • COBOL
  • FORTRAN
  • Pascal
why java
Why Java?
  • Java
    • Java is...
      • popular
      • interpreted
      • platform-independent
      • object-oriented language
why java it s popular
Why Java?It's popular
  • Uses popular syntax
    • Based on C's syntax
    • Also used by:
      • C
      • C++
      • C#
      • JavaScript
      • Perl
      • PHP
why java it s interpreted platform independent
Why Java?It's interpreted & platform-independent
  • Source .java code is compiled into intermediate (byte) code
    • Byte code is executed in software via another program called an interpreter
    • Benefits:
      • More safety features and run-time checks can be built into the language
      • Code can be platform-independent
      • As long as the correct interpreter is installed, the same byte code can be executed on any platform
slide7

The same .class file can execute on any platform, as long as the JRE is installed there

JRE for Mac

Java

Source

Code

(.java)‏

Java

Byte

Code

(.class)‏

JRE for Windows

Java Compiler

Program Execution

JRE for Linux

11001001000101110101010100100010101101010101000101011101011010101001

Hello World!

why java it s interpreted platform independent1
Why Java?It's interpreted & platform-independent
  • Drawback:
    • Interpreted code can execute more slowly than regular compiled code
    • Since program is run in software rather than hardware, it may not match the execution times of code that is compiled for specific hardware
      • Ex: C, C++ code
    • No language is best for every application
    • However, newer Java implementations can use JIT compilation of bytecode to execute faster
why java it s object oriented
Why Java?It's Object-Oriented
  • Object-oriented
    • Primary mode of execution is interaction of objects with each other
    • We will discuss object-oriented programming in much more detail soon
running executing java programs
Running (Executing) Java Programs
  • First we must compile our source (.java) code into the intermediate (.class) code
    • We do this with the Java Compiler
    • javac program
  • Next we must interpret our .class code to see the result
    • We do this with the Java Interpreter, or Java Runtime Environment (JRE)‏
    • java program
  • IDEs (e.g. Eclipse) simplify this process
running executing java programs1
Running (Executing) Java Programs

Java

Source

Code

(.java)‏

Java

Byte

Code

(.class)‏

java

javac

Program Execution

11001001000101110101010100100010101101010101000101011101011010101001

Hello World!

hardware
Hardware
  • How does the computer execute Java programs?
    • Secondary Storage
    • Main Memory
    • CPU
    • Input Devices
    • Output Devices
hardware1
Hardware
  • Secondary Storage (e.g. Hard drives, CDs, DVDs, ...)‏
    • Holds program files (source code and bytecode)‏
    • Input files (and output files)‏
    • Libraries
  • Input Devices (e.g. keyboard and mouse)‏
    • User-supplied input
  • Output Devices (e.g. screen and printer)‏
    • Provides user with output from program
hardware2
Hardware
  • Main Memory
    • Also called RAM (Random Access Memory)‏
    • Contains currently running programs and their data
    • Divided into parts, accessible by different addresses
      • More on this in a few weeks
  • CPU
    • Performs the work for the program
    • Reads instructions and executes them