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(); |
|
} |
|
} |
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
Important-Java-Concepts/java_basicsI_and_oops/encapsulation/code07_private_access_modifier_is_accessible_only_within_class.java
Lines 3 to 6 in a22280e
Important-Java-Concepts/java_basicsI_and_oops/abstraction/code2_abstract_class_real_scenario_example_bank.java
Lines 6 to 23 in a22280e
Important-Java-Concepts/java_basicsI_and_oops/abstraction/code4_abstract_class_can_have_data_member_method_body_contructor.java
Lines 8 to 12 in a22280e
Important-Java-Concepts/java_basicsI_and_oops/abstraction/code1_abstract_class_and_abstract_method.java
Lines 6 to 15 in a22280e
Important-Java-Concepts/java_basicsI_and_oops/class_and_object/code08_initialization3_by_using_constructor_with_parameters.java
Lines 3 to 19 in a22280e