Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.

Similar presentations


Presentation on theme: "Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee."— Presentation transcript:

1

2 Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee

3 Introduction to JAVA High Level Programming Language (HLL) Java, released in 1995, is a relatively new programming language. Developed by James Gosling from Sun Microsystems and his team

4 Creating a Java Program javac.java java.class

5 Java Program: a set of instructions for the computer to follow. The source code. Saved as filename.java Data: data for the Java program Java Compiler (javac): translates the program from Java to a language that the computer can understand. Byte Code Program: the compiler translates Java into a language called byte-code. Byte code is the machine language for Java Virtual Machine (JVM). filename.class Byte Code Interpreter (java): the interpreter (JVM) translates byte code into machine language (.exe) Machine Language: is the la nguage the computer understands.

6 Parts of a Java Program import java.io.*; public class Hello { public static void main (String[ ] args) { System.out.println(“Hello."); System.out.print(“Welcome to Java Programming!"); } } This is same as header file in C. This package is used for input and output.

7 Parts of a Java Program import java.io.*; public class Hello { public static void main (String[ ] args) { System.out.println(“Hello."); System.out.print(“Welcome to Java Programming!"); } } Every Java program is a class. The program starts with the name of the class. The class name must be the same as the. java file you save.

8 Parts of a Java Program import java.io.*; public class Hello { public static void main (String[ ] args) { System.out.println(“Hello."); System.out.print(“Welcome to Java Programming!"); } } A main method is needed for execution to start. This main method gets executed first. The array of strings parameter is must.

9 Parts of a Java Program import java.io.*; public class Hello { public static void main (String[ ] args) { System.out.println(“Hello."); System.out.print(“Welcome to Java Programming!"); } } Output statements: the basic output statement in Java is the System.out.println( ) or System.out.print( )

10 Variables Most Often Used Data Type Keyword Kind of Value Bytes of Memory Range of Values Character char 1 character2 not applicable Bytebyteinteger1 -128 to127 Short integer short Integers 2 -32,768 to 32,767 (-2 15 to 2 15 - 1) Integer int Integers4 -2,147,483,648 to 2,147,483,647 (-2 31 to 2 31 - 1) Long Integer long Integers8 -9223372036854775808 to 9223372036854775807 (-2 63 to 2 63 - 1) Floatfloat Decimal values to 7 decimal digit precision 4 3.4e-38 to 3.4e38 positive and negative DoubledoubleDecimal values to 15 decimal digit precision 8 1.7e-308 to 1.73e308 positive and negative Boolean bool Boolean (Logical) values True or False 1not applicable

11 Constant Variables Constant is a variable whose value does not change in the program. Eg: PI = 3.14 The keyword ‘final’ is used to define constant in Java Eg. final int count = 100; final double PI=3.14;


Download ppt "Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee."

Similar presentations


Ads by Google