You are on page 1of 5

Core Java Free Batch by Kannababu (5min)

==================================================================
Core Java

Basics OOPS Adv Concepts


operators ExceptionHandling
variables Packages
Datatypes MultiThreading
PDLC Java new features
Conditional Collections
Statements Generics
Loops
Arrays
==================================================================
OOPS:- Object Oriented Programming System
OOPS is a concept which is used to develop programs by using classes
OOPS was invented by Grady Booch
Principles of OOPS:-
1. Abstraction
2. Encapsulation
3. Inheritance
4. Polymorphism
Programming Languages are developed by following the principles of OOPS
Q)what is Object Oriented Programming Language?
Any language that supports the above 4 principles then that language is
called as
Object Oriented Programming Language
Ex:- C#.net,java,python,Typescript
Q)what is Object Based Programming Language?
Any language that supports atleast one among the above 4 principles then
that language is called as Object Based Programming Language
Ex:- vbscript,javascript
prerequisite of OOPS:-
1. Data
2. Operation
Q)what is Data?
Data is collection of rawfacts
Data

store

Memory

Temp Permanent
Ram Harddisc
Files
Database
========================================
Data

numeric character boolean

integer floatingpoint SC GC ANC bool -1bit


byte -1 float-4 char -2 String
short-2 double-8
int -4
long-8
Q)what is integer?
a number without decimal point is called as integer
Ex:- eno,accno,debitcardno,creditcardno,adharno
Q) what is floating point?
a number with decimal point is called as floatingpoint
Ex:- height,weight,price,empsal,percentage,temp,cbal
Q)what is char?
char is an alphabet or symbol or special character
in java char value must declare within single quotes ''
Ex:- grade,status,currencytype,CGPA
Q)what is String?
String is group of characters or alphanumeric characters
Ex:-
ename,sname,qualification,designation,hallticketno,emailid,panno,password
Q)what is boolean?
boolean is used to store true/false
Ex:- martialstatus,result,
===========================
variable :- Variable is the name given for a particular memory location
The purpose of the variable is to store the value
method :- Method is a subprogram which is used to perform a specific operation
============================
Abstraction:- it is a process of getting the required data and hiding unnecessary
data
Encapsulation :- it is a process of binding or wrapping or grouping of state and
behavior
in a single container
in object oriented programming Languages like C#.net,java,typescript we can achive
Encapsulation by using class
class Student class Employee
{ {
int sno; int eno;
String sname; String ename;
int age; double bsal;
String designation; void calDa()
void setStudent() { }
{ } void calHra()
void calTotal() { }
{ } void calTotal()
void calPer() {
{ } }
} }
====================
variable:- variable is the name given for a particular memory location
Q)what is the purpose of variable?
The purpose of variable is to store the value
syn to declare variable:-
datatype varname;
Q)what is variable declaration?
Declaring the variable without assigning the value is called as variable
declaration
int empno;
Q)what is variable Initialization?
Assigning the value to the variable at the time of declaration is called as
variable Initialization
int empno=101;
Q)what is variable Assignment?
Assigning the value to the variable after declaration is called as variable
Assignment
int empno;
empno=101;
Different Types of variables:-
1. Static variable
2. Instance variable
3. Local variable
4. Method Parameter
Static variable:-Static variable must declare with static keyword
Static variable must declare inside the class and outside the method with static
keyword
class Student
{
static String collegename="sathyatech";
public static void main()
{
}
}
instance variable :- instance variable must declare inside the class and outside
the method without any keyword
class Student
{
int sno;
String sname;
public static void main()
{
}
}
Local variable:-The variable that was declared inside the method or within the
block is called as Local variable
Local variable must intialize with some value
class Student
{
void calTotal()
{
int total=100;
}
}
MethodParameters :- The variables that are declared within the method paranthesis
are called as MethodParameters
class Student
{
void calTotal(int m1,int m2,int m3)
{
int total=m1+m2+m3;;
}
}
=========================
class Student classname:- Student
{ static variable:- collegename
static String collegename="sathya"; instance variable:- sno,sname
int sno; Method parameters:m1,m2,m3
String sname; Local Variables:- total
void calTotal(int m1,int m2,int m3)
{
int total=m1+m2+m3;
}
}
====================================
class Student
{
static string collegename;
static string collegeaddress;
int sno; string sname;
int total;
void SetStudent(int no,string name)
{ }
void CalTotal(int m1,int m2,int m3)
{ }
void CalPercentage()
{ int percentage = total / 3; }
void GetGrade()
{ char grade = 'A'; }
}
=========================
Q)what is object?
object is instance of class
instance means allocating sufficient memory space for instance variables
i.e whenever we create object for a class then memory will allocate for
instance
variables
we can create multiple objects for a single class
syn to create object:-
classname objectname=new classname();
reference is created object is created
object creation steps:-
1. object is created
2. reference is created
3. address of the object was assigned to reference
new is a dynamic memory allocation operator which is used to create object
i.e memory will allocate for instance variables
Q)what is Reference variable?
Reference variable is the name given for the object
Q)what is the purpose of Reference variable?
The purpose of Reference variable is to invoke methods
======================
class :- variable and methods
variable:- store the value
method:- perform operation
object creation :- memory allocation for instance variables
Reference variable:- accessing the methods
=======================
Developing First program:-
1. write the program
2. save the program
3. compile the program
4. execute the program
java program-->.java-->javac-->.class file-->JVM---> native code--->O.S-->H/W->O/P
byte code GarbageCollector
Jitcompiler
Q)How to save java program?
classname.java
Q)what is javac?
javac is a compiler which will check syntax Errors
Q)How to compile java program?
javac classname.java
Q)what softwares are required to work with java?
JDK=Java Development Kit
JDK=JRE+Development Tools
compiler
JRE= Java Runtime Environment
JRE=Library Classes +JVM
JVM=GarbageCollector+JitCompiler
===================================
1. goto E Drive and create a folder with name Demo
2. open notepad and write the program
class FirstProgram
{
public static void main(String[] args)
{
System.out.println("Welcome to sathyatechnologies");
}
}
3. save the program in E:/Demo with name FirstProgram.java
4. open command prompt
change the Drive
E:
5. change the directory
cd Directoryname
cd Demo
6. compile the program
javac filename.java
javac FirstProgram.java
7.Execute the program
java Firstprogram

You might also like