Академический Документы
Профессиональный Документы
Культура Документы
Prepared by:
zhayk_denki
JAVA History
Java
was
created in 1991 by James Gosling et al. of Sun Microsystems. Initially called Oak, in honor of the tree outside Gosling's window, its name was changed to Java because there was already a language called Oak.
-takumo-
JAVA History
Java
The
original motivation for Java the need for platform independent language that could be embedded in various consumer electronic products like toasters and refrigerators.
JAVA History
One
At
about the same time, the World Wide Web and the Internet were gaining popularity. Gosling et. al. realized that Java could be used for Internet programming.
What is JAVA?
Is
an object-oriented language that is used for general-purpose business programs and interactive Wide Web based Internet programs. It is architecturally neutral, which means JAVA can run in different platforms.
What is JAVA?
Java has its own interpreter or compiler. It translates for the host machine. The compiler translates the written syntax into bytecode which is read by the JAVA VIRTUAL MACHINE (JVM). A Java Virtual Machine (JVM) is a virtual machine that interprets and executes Java bytecode.
Starting a Program
Consider the following simple program. This is written on seven lines, and its only task is to print First Java Program on the screen. public class First { public static void main (String [] args) { System.out.println(First Java program); } }
The string First Java program appears within the parentheses () because string is an argument to a method, and arguments to methods always appear within parentheses. Println is the method. Arguments consists of information that a method requires to perform its task.
Dissection of Codes
System.out.println(First Java Program); System - is a class, defines attributes of a collection system objects.
Passion for training. Passion for technology.
Out - is an object of a class. It represents the screen. println - is a method. Command to display.
Dissection of Codes
public class First public - is an access identifier, which defines how the class is accessed. Just follow it with class First which is the name of the class.
Modifying a Program
To edit a program you must open an existing program. Public class Hello { public static void main (String [] args) { System.out.println(My new and improved); System.out.println(Java program); } }
-takumo-
Byte 1 2 4 8
Int Long
Using Int
Create a program that will use int as a data type of a variable: public class DemoVariables { public static void main(String [] args) { int oneInt = 315; System.out.print(The int is ); System.out.println(oneInt); } }
Shortcut of output
In the previous program, we used two print method like this: System.out.print(The int is ); System.out.println(oneInt);
Passion for training. Passion for technology.
We can use this shortcut method to make it easier. System.out.println(The int is + oneInt);
Modifying to variables
Edit the program of class Number so that the output will be in the shortcut method. System.out.println(The short is + oneShort); System.out.println(The long is + oneLong);
Arithmetic Statements
Addition
Value1 = 43 Value2= 10
Value1 = 43 Value2= 10
Value1 = 43 Value2= 10
Value1 = 43 Value2= 10
Value1 = 43 Value2= 10
Value1 = 43 Value2= 10