


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This pdf contains notes for java object oriented programming concepts
Typology: Cheat Sheet
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Definition: 1. Programming Language : Java is a platform-independent, HIGH LEVEL , Object oriented, robust programming language
. Java is a platform because java has its own runtime environment (JRE) History: - > Company : Sun Microsystems (now Oracle) - > Created By : James Gosling & team Idea : Java idea came because designers wanted to create a language which should be platform independent based on “ write once, run anywhere” concept, tight coded programming language etc - > Name : Oak - > Year : 1991 (development) Name: Java (on Indonesia famous ‘Java’ coffee)-> 1995 (release) Editions:
Explain Java program structure A java code has 5 main sections-
This part is OPTIONAL - > To create documentation section we use comments - > There are 3 types of comments :- Single Line Comment (//) Multi-Line Comment (/* ----- */) Documentation Comment
Syntax : 1. import <packagename.sub-package_name.ClassName>;
if we use "import packagename.*;" only classes or interfaces will be imported, not the subpackage. - > If we dont want to use import statement then we can directly write the packagename.ClassName to use that class. - > This line is written after the package line. 4. Interface/Class Section :
Variables & Methods
JIT compiler o Interpreter – it decodes and executes each statement of code one by one. o JIT compiler: While the interpreted program is being run, the JIT compiler determines the most frequently used code and compiles it to machine code. It is used when required at runtime only, thts why it is Just In-Time compiler. It improves the performance of execution. JIT compiler executes only for repetitively executed code. JIT, or Dynamic Translation, is compilation that is being done during the execution of a program. JIT compiler will compile the bytecode into machine instructions of the running machine means, that the resulting machine code is optimized for the running machine’s CPU architecture. Datatypes
Java introduced autoboxing and unboxing in J2SE 5.0 version. which coverts primitive into object and object into primitive datatype automatically.
When boxing(conversion of primitive data type into its corresponding wrapper classes) is done automatically by java compiler, that thing is called autoboxing.
Auto-unboxing is opposite conversion of autoboxing, the automatic conversion of an object of wrapper type to its corresponding primitive value by java compiler. Example : class HelloWorld { public static void main(String[] args) { int a=5; Integer A= new Integer(a); // boxing or wrapping int b= A.intValue(); // unboxing or unwrapping //Integer A= a; //autoboxing //int b= A; //autounboxing System.out.println(b); } }