0% found this document useful (0 votes)
31 views

Core Java

The document provides an overview of Core Java, covering its history, the Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK). It explains Java data types, type casting, and object-oriented programming concepts such as classes, objects, inheritance, and polymorphism. Additionally, it includes instructions for setting up Java on a system and writing basic Java programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Core Java

The document provides an overview of Core Java, covering its history, the Java Virtual Machine (JVM), Java Runtime Environment (JRE), and Java Development Kit (JDK). It explains Java data types, type casting, and object-oriented programming concepts such as classes, objects, inheritance, and polymorphism. Additionally, it includes instructions for setting up Java on a system and writing basic Java programs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Core Java

Introduction:
 History
 JVM
 Java Setup in System
 Java first Program
 Variables
 Java data types
 Type casting
 Java Operations
 If else
 Switch Control
 Loops (For, while, Do while, For-each)
 Continue and Break statement with example.

History:
1. Sun Microsystem (1991) created.
2. Oracle acquired.
3. Oak previously named.
4. Development Team - James Gosling and Patrick Naughton and team
5. Father of Java – James Gosling
6. Java is Object-Oriented, General-Purpose Programming, Robust, Platform
independent programming language.
7. Desktop applications – Swing, Enterprise Application, Mobile Application and
Android Application for Java is used.

JVM JRE JDK :


JVM – Java Virtual Machine.
Bytecode how execute, here specification is summarized, It is a hypothetical
machine.
JRE – Java Runtime Environment.
But how the bytecode be executed for that JRE used and other prebuilt libraries also
would be there.(implementation)
Inside JRE, we will get JVM.
For running the program JRE is must.
JDK – Java Development Kit
Here compiler and Debugger both are present.
So, JDK > JRE > JVM

Java Setup in System:


 JDK needs to install.
 IntelliJ Idea to install.

Javac.exe and Java.exe (Compiler)

Go to environment variable from settings  New  add Java Path

From notepad to CMD 

1. Files create with extension java.


2. Javac filename
3. Java class name

IntelliJ Idea community version needs to install.

Java Data Types:


Data Types represents which type of value can be stored by Variables.
Java is a static programming language.
Data Types are of 2 types:
a) Primitive Data Type/ In Built Data Types.
b) Non-Primitive Data Type/Reference Data Types/ User Defined Data Types.

Primitive Data Type/ In Built Data Types:


 In Built, fixed size, fixed range.
 Total 8 primitive data types in Java i.e.
 Byte, Short, Character, Short, Int, Long, Float, Double.
Type Description Default Size Example Literals Range of Values

Boolean True/False False 1 True, false True, false


bit
Byte 2’s 0 8 (none) -128 to 1127
complement bits
integer
Char Unicode \u0000 16 ‘a’,’\u0041’,’\101’,’\\’,’\’,’\ Character representation
Character bits n’,’B’ of ASCII values
0 to 255

Short 2’s 0 16 (none) -32,768 to 32767


Complemen bits
t integer
Int 2’s 0 32 -2,-1,0,1,2 -2147483648 to
Complemen bits 2147483647
t integer
Long 2’s 0 64 -2L,-1L,0L,1L,2L -9223372036854775808
Complemen bits to
t integer 9223372036854775808

Float IEEE 754 0.0 32 1.23 e 100f,-1.23e- Upto 7 decimal Points


Floating bits 100f,.3f,3.14f
Point
Double IEEE 754 0.0 64 1.23456 e 300d,-1.23456 Upto 16 decimal Points
Floating bits e-300d,1e1d
Point

TYPE CASTING:
Conversion of one data type to another data type
Type casting of 2 types:
a) Implicit Type Casting (Automatically JVM)
b) Forcefully by Programmer (Explicit Type casting)
Implicit Type Casting Eg.
int i = 50;
double a;
a = I;
Forcefully by Programmer, Eg.
double myval =34.23
int myint = (int) myval;

Automatic Conversion

40 40.0

61 61.63

Forcefull Conversion

Object Oriented Programming Language


 Class
 Object
1. New Keyword
 Constructor
 Overloading
1. Constructor Overloading
2. Method Overloading
 This Keyword
 Inheritance
 Types of Inheritance
1. Super keyword
 Overriding
1. Method Overriding
 Encapsulation
 Abstraction
1. Abstract Class
2. Interfaces
 Polymorphism
1. Compile Time Polymorphism
2. Run Time Polymorphism

Programs can be written in different different styles i.e. Paradigm, Methodoly,Procedures.


Procedures wise programming – Procedural Programming.
Function wise Programming – Functional Programming.
Procedures + Function = Object + Class = Object Oriented Programming.
Objected Oriented Programming is a methodology.

Method Overriding:
Lets say A person name “Mohan” has property of X;
Shyam can reuse the X;
Shyam may be not satisfied with X;
So he redefined;
Function + body(functionality Property)
So Shyam can redefined the body.
Child overrides the body.

You might also like