View Code? Open in Web Editor
NEW
๐ Complete Java - A to Z โ ๐ Notes and Programs of all Important Concepts of Java - OOPS, Data Structures, Algorithms, Design Patterns & Development + Kotlin + Android :fire:
Home Page: https://www.suryakantbharti.com
Java 67.21%
Kotlin 32.79%
important-java-concepts's People
Contributors
important-java-concepts's Issues
java design patterns documentation is not finished
kotlin algos pkg names needs to be corrected
Is it just me or in most of the examples the spacing is all messed up, sometimes it is 1 space, then 4, then none
class A {
private int data =40 ;
private void msg (){System .out .println ("Hello java" );}
}
abstract class Bank {
abstract int getRateOfInterest ();
}
class SBI extends Bank {
int getRateOfInterest (){return 7 ;}
}
class PNB extends Bank {
int getRateOfInterest (){return 8 ;}
}
class TestBank {
public static void main (String args []){
Bank b ;
b =new SBI ();
System .out .println ("Rate of Interest is: " +b .getRateOfInterest ()+" %" );
b =new PNB ();
System .out .println ("Rate of Interest is: " +b .getRateOfInterest ()+" %" );
}}
abstract class Bike {
Bike (){System .out .println ("bike is created" );}
abstract void run ();
void changeGear (){System .out .println ("gear changed" );}
}
abstract class Bike {
abstract void run ();
}
class Honda4 extends Bike {
void run (){System .out .println ("running safely.." );}
public static void main (String args []){
Bike obj = new Honda4 ();
obj .run ();
}
}
class Student4 {
int id ;
String name ;
Student4 (int i ,String n ){
id = i ;
name = n ;
}
void display (){System .out .println (id +" " +name );}
public static void main (String args []){
Student4 s1 = new Student4 (111 ,"Karan" );
Student4 s2 = new Student4 (222 ,"Aryan" );
s1 .display ();
s2 .display ();
}
}