Core Java Day7
Core Java Day7
polymorpyism
method overloading
main()
{
sort(sub)
sort(num)
}
inheritance
class vehicle
{
public void run();
}
class bike extends vehicle
{
public void run()
{
}
main()
{
Vehile v;
v= new Car()
v.run();
v = new Bike()
v.run()
--------------------------------------------------------
byte
sort
int
long
float
int a = 10;
float b = a;
float b = 10.5f
int a = (int)b
------------------------------------------------------------------------
Abstraction
what is abstraction
abstract class
if class has abstract keywod and one or more abstract method is called
1) abstract class can have abstract method and non abstract method
2) you cannot create object of abstract class
3) it ment for inheritance
3) which ever class is extending ,should provide the implementation for the
abstract method
0 to 90%
interface
100%
interface msoffice
{
open()
new()
saveas()
}
----------------------------------------------------------------------
java application
interface connection
{
public abstract connect()
----------------------------------------------------------------------
interface list
{
void add()
void remove()
}
}
void remove()
{
}
void remove()
{
}
main()
{
linkedlist ll = new linkedlist()
ll.add()
test
{
}
----------------------------------------------------------------------
part III
packages