Professional Documents
Culture Documents
By
Mr. Arun Kumar A
JAVA
• What is JAVA?
• JAVA is a platform independent programming
language
• Inventors of JAVA
• James Gosling, Mike Sheridan, Patrick
Naughton
Editions of Java
• J2SE -> Java Standard Edition
• J2EE -> Java Enterprise Edition
• J2ME -> Java Micro Edition
Difference Between JDK,JRE,JVM
Features of java
• 1)Simple
• 2)Secured
• 3)Platform independent
• 4)Architecture Neutral
• 5)Object oriented
• 6)Interpreted
• 7)High performance
• 8)Distributed
• 9)Dynamic
• 10)Robust
• 11)MultiThreaded
• 12)Portable
What is Java
Naming Conventions in Java
• Package name starts with lower case and each and
every word starting letter in upper case
• Example -> package myPack;
• Classes and interfaces starts with upper case and each
and every word starting letter in upper case
• Example -> class MyClass{
• Methods and variables start with lower case and each
and every word starting letter in upper case
• Example -> void add(){
-> int a = 10;
What are keywords
• Reserved words meant specific to
programming language and not to be used for
any other purpose
Identifiers
• Used for identification what ever names we use
in programs comes under identifiers
• RULES
• It should start with character (either upper case
or lower case) special character such as
underscore(_) and dollar allowed
• Numbers allowed but cannot start with numbers
• No keywords are to be used as identifier
Java Data Types
Data Type Size Range of values Default Values
->byte 1 -2^7 to 2^7-1 0
->short 2 -2^15 to 2^15-1 0
->int4 -2^31 to 2^31-1 0
->long 8 -2^63 to 2^63-1 0
->float 4 single precision 0.0
->double 8 double precision0.0
->char 2 unicode \u0000
->boolean 1bit true,false false
Architecture of JVM
Development Tools
• ->javac -> for compilation converting .java into
.class file java code to byte code file
• ->java -> for execution
• ->javap -> disassembler to view the class
• ->javadoc -> extracts documentation
comments
Comments
• Ignored by the compiler used for increasing
readability and understandability of program
• Three types of comments
• ->//single line comment
• ->/*Multi line
– Comment*/
– /**documentation comment*/
Is Java pure object oriented porgramming
language
• No
• Why?
• Because still data types are primitive and not
class we have wrapper classes which can give
object representation of the data
First Example-Hello world
Which is the default package imported by all
applications in java
• ->java.lang.*
• ->System and String is a class in java.lang
package
• ->System.out creates an instance or object of
PrintStream class in the package java.io.* with
which we access the println method and print
on the console screen
• System.out.println()
• System.out.print()
• System.out.printf()
• System.out.println(10+10+”Addition”)
• System.out.println(“Addition”+10+10)
• System.out.println(“Addition”+(10+10))
Variables in java
• Instance variable -> which comes inside the class but
outside all methods if uninitialized takes default
values access modifiers allowed
• Class/static variable -> which comes inside class but
outside all methods with static keyword if
uninitialized takes default values access modifier
allowed
• Local variable- >which comes inside methods must
be initialized else compiler error no access modifier
allowed
How to get input from user
• First import the java.util package
• Create an instance for Scanner class
• And access its respective methods to get the
input
• Scanner sc = new Scanner(System.in)
• Here System.in is a stream from which
represents a standard input device here it is
keyboard
How to get inputs methods of Scanner class