Você está na página 1de 10

SEMINAR REPORT

National Institute of Science & Technology

ON

“CORE JAVA”
PRESENTED BY

IPSITA MISHRA Roll No# EEE200750188

NATIONAL INSTITUTE OF SCIENCE & TECHNOLOGY


BERHAMPUR, ORISSA

PRESENTED BY IPSITA MISHRA [1]


INTRODUCTION TO JAVA
National Institute of Science & Technology

First Java 1.0 released by Sun Microsystems in 1995 with the


tagline-’Write-Once-Run-Anywhere’
Java is a case sensitive language
Syntactically similar to C, C++
A robust language because of automatic memory
management and exception handling.
Platform-independent.
Highly secured language.

PRESENTED BY IPSITA MISHRA [2]


INHERITANCE
National Institute of Science & Technology

• A technique of sharing base class property to child class.


• Extends keyword is used to support inheritance
• Class that is inherited is called base class and the class that
inherits the properties of base class is known as derived
class or child class .
• Except private properties of base class child class can
invoke other properties of base class.
• Java supports single inheritance and multi level
inheritance but it doesn’t support multiple inheritance.

PRESENTED BY IPSITA MISHRA [3]


SYNTAX
National Institute of Science & Technology

Class X {
// code
}
Class Y extends X{
//code
}
Class z extends y{
//code
}
• multilevel inheritance is supported by java.

PRESENTED BY IPSITA MISHRA [4]


ADVANTAGES AND
National Institute of Science & Technology

DISADVANTAGESOF INHERITANCE
• Reusability of code. As child class uses base class
properties so no need to write the code again in child class
if it is present in base class.
• Extendibility.
• Supports run-time polymorphism.

• The main disadvantage is base class and child class are


tightly coupled to each other. When ever a new feature is
added then both base class and child class is changed

PRESENTED BY IPSITA MISHRA [5]


CONSTRUCTOR IN JAVA
National Institute of Science & Technology

•Constructor is used to initialize the object


•Non static methods call the other nonstatic methods
outside the class through object. so we use constructor.
•Constructor in java is two type.
default constructor
parametrise constructor

Eg:public class Test{


Test(string s){
System.out.Println(s);}
Public static void main(String args[])
{Test t2=new Test(“java”);}}//parametrise constructor is
called

PRESENTED BY IPSITA MISHRA [6]


National Institute of Science & Technology

SUPER KEYWORD
• Used only in case of inheritance.
• Super points to the current super class object
• Super keyword is never used in static method and static
block
• When the instance variable name of base class is same as
child class then super key word must be used in order to
differentiate between instance variable of base class and
instance variable of child class.

PRESENTED BY IPSITA MISHRA [7]


METHOD OVERRIDING
National Institute of Science & Technology

• Method overriding is only possible in the case of


inheritance
• base class method is overridden in its child class.
• In the case of method overriding method name, its
argument type, number of arguments, and return type
is exactly the same as that of base class.
• when method is over ride the method in child class is
over ride by same access specifier or least restrictive
acess specifier.
• Private methods can not be overridden.
• Static and final methods can also not be overridden.

PRESENTED BY IPSITA MISHRA [8]


FINAL KEYWORD
National Institute of Science & Technology

• Used in class, method, and variable


• If the class is declared as final, it cannot be inherited
• String, math, wrapper classes are treated as final so
they have no child class.
• Final method can not be overridden
• Final variable must be initialized.
• Final variable cant be changed or modified.
• A static variable can be a final variable

PRESENTED BY IPSITA MISHRA [9]


National Institute of Science & Technology

PRESENTED BY IPSITA MISHRA


THANK YOU

[10]

Você também pode gostar