You are on page 1of 8

JDK - Java Development Kit

JRE - Java Runtime Environment

Data types -
1. Primitive Data type 2. Non-Primitive Data type
byte - it stores no.
int - simple no.
float - Stores decimal nos.
double - Floting type no. store
char -
boolen - True or False
short - Shortt int. store

08-03-2022
Standard Stream (in, out &

booolean - true or false (2 data)

Stream - collection of data, continous flow of data, conection btw java appl &
source destination.
2 types - byte stream & chracter stream futher again divide in sub types

Scanner class is used to read input through keyword system.in


It is use to obtain user input value & also primitive data types like byte, int,
double & etc.
Scanner class is found inside java.util.scanner; / java.util.*; package.

bufferedreader & scanner class are same but main difference is scanner has buffer
of 1kb & bufferedreader has buffer of 8kb.
bufferedreader is faster than scanner class.
in bf we read stream or text data, while in scanner we can store all primitive data
types.

class Demo
{
Public static void main(String[]args)
{
int a=10; //assign value 10 to a ident

Scanner s = new Scanner(System.in); //created a object of scanner class

System
}

/// Write program to enter employ details of 5 ///

public - asses modifire


static- keyword
void- When funcation is rturn it is accepted that no value will return.
main- funcation
[]- array
args- argument

/// Command line arguments ///


class Demo
{
public static void main(String [] args)
{
System.out.println("command line argument");

for(String s:args) // loop pass through all args.


{
int a= Integer.parseInt(s);
System.out.println(s);
}
}
}

11-03-2022
//scanner
java.util.*;
class Ar
{
public static void main(String []arg)
{
Scanner s= new Scanner (System.in);
String s =nextline
}
}

BufferedReader is java class that read text from input stream.


8192 internal chracter it is stored in internal buffer & can br read individual.
bufferedReader is faster than Scanner class.

//bufferedReader

import java.io.BufferedReader;
class Ar
{
public static void main(String []arg) throws IOException
{
InputStreamReader isr= new InputStreamReader(System.in);
BufferedReader br= new BufferedReader(isr); //both are input stream

System.out.println("enter course");
String s=br.readline();
System.out.println("enter course= " +s);

}
}

--------------------------------------------------------------------------------

class Emp
{
String name;
int id;
int age;
Emp(String name, int age, int id)
{
this.age=age,
this.name=name,
this.id=id;
}

void display()
{
System.out.println("Name= " +name);
System.out.println("Age= " +age);
System.out.println("Id= " +id);
}

class Ar
{
public static void main(String []args)
{
BufferReder br = new bufferedReder(new InputStreamReader (System.in));
System.out.println("Enter Name");

String s=br.readline();

Systemout.println("Enter Age and Id");

int age= Integer.parseInt(br.readline());


int id= Integer.parseInt(br.readline());

Emp em = new Emp(name, id, age);


em.display();
}
}

-------------------------------------------------------------------------------

String class provide formate method it gives formatted output in java. it comes
under the string class.
fro print this string 2 method
format program & printf method.
%b - true & false
%x - hexi decimal

class Ar

{
public static void main(String []args)
{
String l= "java"; // for c printf("%s", 1);
int n= 60;
String res;

res= String.format ("Lang = %s", l);


res= String.format("value = %d ", n);

System.out.println(res);

}
}
***********************************************************************************
****************************************

12-03-2022 //Extra lect.


Features of java are
inheritence, abstraction, ecapsulation, Polymorphism.

Methods of java

1. Constructor- it is use to initalllize to creat new object in class. class name &
method name should same.
to invoke the objecct constructor is use.
it must not have a return type.
3 types - 1. default - if we do not creat any constructor java
creates its own constructor.
2. Paramertized - Constructor Accepts args. // aa(String
A)
3. NO arg - no args is passed called. //aa()ty
4. Copy Constructor - it is use to copy same method used
in constructor.

class Main //Exp. of No arg


{
String name;
Main()
{
System.out.println("Constructor Calling");
name= "java";

}
public static void main (String [] args)
{
Main m = new Main();
System.out.println("the name is" + m.name);
}

}
-----------------------------------------------------------------------------------
-----------------

class Main //Exp. of No Paramertized


{
String lan;
Main(String l)
{
lan=l;
System.out.println(lan+ "Programing lang");

}
public static void main (String [] args)
{
Main m = new Main("Java");
Main m1 = new Main("Bava");
Main m2 = new Main("Mava");
System.out.println(lan+ "Programing lang");
}

}
-----------------------------------------------------------------------------------
-----------------
Default constructor - if we do not creat any constructor, java creats its own
constructor. default constructor is always 0

class Main
{
int a;
boolean b;
public static void main (String [] args)
{
Main m= nw Main();
System.out.println("value of a" = +m.a); // a=0
System.out.println("value of a" = +m.b); // b= false

}
-----------------------------------------------------------------------------------
------------------
"This" keyword

class Student
{
int roll;
String Student;
Student(int roll, String Name)

{
this.roll = roll;
this.name= name;
}
void display()
{
System.out.println("roll n0" = +roll+ "Name= " +name);
}

class Rohan
{
public static void main (String [] args) //present in only one calss. main
function name to file
{
Student s1= new Studnet (12, "AAdarsh");
Student s1= new Studnet (13, "Xyz");

s1.display();
s2.display();
}
}
***********************************************************************************
*************************************------------------------

13-03-2022
Constructor - name & class name same called constructor.
Copy Constructor - It is use to creat copy of object that has multiple fields.
2 types :
1. Shallow - makeing temporary changes call as shallow copy.
aadress are diffferent. changes not refelect in
original.
2. Deep - when the vale us assign to variable & if we take same
variable again then the value will over lap in this previous value get vanished &
updated value remains.
aadress are same. changes refelects in original.
3. Clone method - import java.lang

merits - to avoid clone method, easy to use than avoid clone.

***********************************************************************************
**********************************

14-03-2022
// Arrays
basically it is a collection of similar datatypes /elements.

Syntax - datatype [] arname = new datatype[size];


datatype - it is a primative data type bytes, int, flot, double etc.
int [] - single dimensional array.
int [] [] - multi/ double dimensional array.
int[] [] [] - three dimensional array.

***********************************************************************************
******************************

15-03-2022

Arrays to the funcation


jagged array is an array of arrays such that members
also called as multi-dimentional array.

***********************************************************************************
******************************************

31-03-2022

JDK - Java Development Kit


JRE - Java Runtime Environment & uses

Data types -
1. Primitive Data type 2. Non-Primitive Data type
byte - it stores no.
int - simple no.
float - Stores decimal nos.
double - Floting type no. store
char -
boolen - True or False
short - Shortt int. store

Standard Stream (in, out & ____ )

booolean - true or false (2 data)

Stream - collection of data, continous flow of data, conection btw java appl &
source destination.
2 types - byte stream & chracter stream futher again divide in sub types
Public static void main define
public - asses modifire
static- keyword
void- When funcation is rturn it is accepted that no value will return.
main- funcation
[]- array
args- argument

Array - It is a collection of Simillar data types.


array list - it is a resizable array which can be found in java utill package. it
works on index.

Scanner class is used to read input through keyword system.in


It is use to obtain user input value & also primitive data types like byte, int,
double & etc.
Scanner class is found inside java.util.scanner; / java.util.*; package.

bufferedreader & scanner class are same but main difference is scanner has buffer
of 1kb & bufferedreader has buffer of 8kb.
bufferedreader is faster than scanner class.
in bf reads stream or text data, while in scanner we can store all primitive data
types.

Main Function:
public - asses modifire
static- keyword
void- When funcation is rturn it is accepted that no value will return.
main- funcation
[]- array
args- argument

Features of java are


inheritence, abstraction, ecapsulation, Polymorphism.

Constructor- it is use to initalllize to creat new object in class. class name &
method name should be same.
to invoke the objecct constructor is use.
it must not have a return type.
3 types - 1. default - if we do not creat any constructor java
creates its own constructor.
2. Paramertized - Constructor Accepts args. // aa(String
A)
3. NO arg - no args is passed called. //aa()ty
4. Copy Constructor - it is use to copy same method used
in constructor.

Inheritance : IT is the one in which new class is created that inheretas feature
from the already existing class.
it is of 5 types- single, multipe, multilevel, hybrid & heraarchical inheretance.

polymorphism: it is a event in which task can be implimented in multiple forms. it


basically applied to functions or Methods.
it can be compiled time polymorphism (over loading) as well as run time
polymorphism (over riding).

AWT - Abstract Window Toolkit, it is an javas original platfrom, it is a collection


of gui components, execution is slower, component requires more space.
Swing - it is a GUI widget toolkit for java that is a extension of AWT, it is
platform independent, it is a part of JFC [java foundation classes], execution is
faster, component requires more space.

Vector - it is use to store data in form of list interface. it can grow or shrink
its size.

abstraction - hiding the implementation details & shows the funcationality to user.
- abstract class & Interface.
inheretance - to creat a new class from exesting class.
ecapsulation - hiding of information data or wrapping of data
polymorphism - it is concept in which we can perform single task in multiple ways.
exception - it is an unwaanted or unaccepted event occures during compilations. -
check & uncheck

it can handel by 3 ways - try-catch, throw&throws, final keyword.


exception handeling - it is aevent which handel runtime error.

jdbc odbc steps -


1. Import mysql package
2. load jdbc driver
3. establish connection
4. creat statament or quries
5. executive statment or quries
6. process & rsult
7. close the connection

this keyword - it is used invoke current class or instance variablr or to pass


argument.

getter - to read the variable


setter- to set the value or to update we use setter,

throw - only one exception occure, thats is uncheck exception is propogated & also
it explicite the exception.
throws- multiple exception occure, thats is both check & uncheck exception are
propogated & also it implicites the exception.

ststic block - it is used to inilatize ststic class.


instance block - it is used to inilitze instance variable.

super keyword -

collection - it is a single entity which stores multiple data.

overloading - it contain only one class & different methods.


overriding - it contain 2 class main class & sub class & in sub class different
methods are define.

You might also like