Chapter-I-Java-Runtime-Environment-and-its-Component
Chapter-I-Java-Runtime-Environment-and-its-Component
JAVA
RUNTIME
ENVIRONMENComputer
Fundamentals and Programming
CHAPTER I
OVER
a) Java Virtual Machine
VIEW
b) Creating a Simple, Stand-Alone
Application and Applet
c) Java Comments
d) Features of Java Programs
e) Algorithms
CHAPTER I
INTRO
The Java Virtual Machine (JVM) separates Java from most other
DUCTI
programming languages.
One of the primary design goals of the Java language is to enable the
same code to run on any platform.
ON
The JVM is a software program that behaves like an entire computer.
CHAPTER I
CREATING A SIMPLE,
STAND-ALONE
Give the class a name and a
pair of braces to contain the
APPLICATION
body of the class.
CREATING A SIMPLE,
STAND-ALONE
To begin executing code, the
JVM looks for and calls a
special method by the name
APPLICATION
of public static void
main(String[] args).
CREATING A SIMPLE,
STAND-ALONE
This program is complete. Note that Java programs are case-
sensitive; the word Class is not the same as class.
APPLICATION
You must save the program with your text editor as HelloWorld.java
(giving it the same name as your class), and compile it using a Java
compiler
CHAPTER I
CREATING A SIMPLE,
STAND-ALONE
Bytecode is another element that makes Java different from other
programming languages.
APPLICATION
Other compiled programming languages generate machine
dependent binaries, which are files that contain native machine
language statements. To make Java portable, the Javac compiler
generates bytecode. Java bytecode is composed of an instruction set
native only to the JVM.
CHAPTER I
CREATING A SIMPLE,
STAND-ALONE
To make Java portable, the Javac compiler generates bytecode. Java
bytecode is composed of an instruction set native only to the JVM.
APPLICATION
CHAPTER I
JAVA COMMENTS
When programming, it will be
useful to add comments to
your code.
FEATURES OF JAVA
PROGRAMS
A method is a named sequence of statements. This program defines
one method named main:
public static void main(String[] args) The name and format of main is
special: when the program runs, it starts at the first statement in
main (All java programs begin here) and ends when it finishes the
last statement.
CHAPTER I
FEATURES OF JAVA
PROGRAMS
A class is a collection of methods. In this program defines a class
named MyFirstJava. The name of the class has to match the name of
the file it is in, so this class has to be in a file named MyFirstJava.java.
ALGORITHMS
An algorithm specifies a series of steps that perform a particular
computation or task.
ALGORITHMS
Write an algorithm to add two numbers entered by user:
Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values num1 and num2.
Step 4: Add num1 and num2 and assign the result to
sum. sum←num1+num2
Step 5: Display sum
Step 6: Stop
CHAPTER I
ALGORITHMS
There are two ways of presenting an algorithm.
ALGORITHMS
Flowcharts use special shapes to represent different types
of actions or steps in a process.
Lines and arrows show the sequence of the steps, and the
relationships among them.
CHAPTER I
ALGORITHMS
These are known as flowchart symbols.
1. Rectangle Shape - Represents a process
2. Oval or Pill Shape - Represents the start or end
3. Diamond Shape - Represents a decision
4. Parallelogram - Represents input/output
CHAPTER I
ALGORITHMS
CHAPTER I
ALGORITHMS
CHAPTER I
Problem
Specification
RAM
DEVE
LOPM Data, Method
and Algorithm
Design
Class Design
CHAPTER I
LABORATORY
ACTIVITY #1:
Formulate at least (3) pseudocodes of a Java Program, you
may use the example from the discussion earlier.
PSEUDO-CHARTS
After accomplishing your pseudos, create a flowchart as
well.
LABORATORY
ACTIVITY #2: ALL Full name:
Nickname:
ABOUT YOU!
Based on the discussion and
fundamental parts of a Java program,
create your first Java program
Age:
Gender:
Birthday:
indicating the following Birthplace:
demographics about yourself: Current Address:
Currently studying (Bachelor’s
Degree, full):