It describe small concept of java programming language
Size: 167.43 KB
Language: en
Added: Feb 21, 2019
Slides: 17 pages
Slide Content
Topic: Study Of Java
CONTENDS •Histroy of JAVA •Characteristics of java •Java Programming Rule •Working with Scanner Class •Simple java program •Command Line Argument •Primitive Data Type and Wrapper Class •Drawback of java •Application
History of java 1.In 1994, Java was used to develop a Web browser, named Hot Java. 2. Java is automatic memory management. 3.Java was developed by James Gosling in 1995.
Java Programming Rule 1.Class name declaration:- First letter of the Class must be in upper case. Example: Class StudentDetail 2. Variable declaration:- it allow camel style. Single character declaration is not allowed. Example: int stuAge; int name;
3.Method declaration:-it follow camel style or single word style. Example: void setOfDetail() void set() 4.Constant declaration:- All the cases will be upper case. Example: int AGE=0; 5.Packages:- All cases must be in lower case. Example: import java.util.Scanner
Working with Scanner Class Scanner:- it is a class .which is used to take Input from the keyboard. There are following method of Scanner class 1.nextByte():for byte type input 2. nextInt(): for int type input 3. nextShort(): for short type input 4. nextFloat(): for float type input 5.nextDouble(): for double type input 6.nextBoolean(): for Boolean type input 7.next():for string type input(without space) 8.nextLine():for string type input(withspace)
Java program Import java.util.Scanner; Class Demo { Static public void main(String…argument) { Scanner scanner=new Scanner(System.in); System.out.println(“Student name:”); String stuName=scanner.next();
Command Line Argument Command line arguments are handled using main function()function argument where arg refers to the number of arguments passed and arg[] is a pointer array which points to each argument passed to the program.
class Command { static public void main(String...args) { System.out.println("Your first program is:"+args[0]); } } Compile by: javac file.java Run by : java class name welcome
Primitive data type & wrapper class Boxing: The automatic conversion of primitive data type into its equivalent wrapper class. UnBoxing: The automatic conversion of wrapper class into primitive data type
Example of Boxing Class Boxing { Static public void main(String args[]) { int a=50; Integer a2=new Integer(a); Integer a3=5; System.out.println(a2+” ”+a3); } }
Example of Unboxing Class Boxing { Static public void main(String args[]) { Integer a2=new Integer(50); int a3=a2; System.out.println(a3); } }
Drawback of java Java requires high storage capacity and uses more memory. it become slower in performance compared to other languages.