-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainDemo.java
More file actions
91 lines (70 loc) · 1.71 KB
/
Copy pathMainDemo.java
File metadata and controls
91 lines (70 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
package learnining;
import com.sun.org.apache.xml.internal.utils.QName;
import inheritance.Parent;
final class A{
final public static String name="praveen";
public final void method1(){
System.out.println("Parent class method1");
}
public void method2_parent(){
System.out.println("Parent class Method 2");
}
public static void method3_static(){
System.out.println("Static method from the parent class");
}
public final void method4_final(){
System.out.println("Final method of parent class");
}
}
class B extends A{
@Override
public void method1() {
System.out.println("Child class method1");
}
public void method2(){
System.out.println("Child class method2 ");
}
*/
/*public static void method3_static(){
System.out.println("Static method from the Child class");
}*//*
}
public class MainDemo {
public static void main(String[] args) {
*/
/*A a=new B(); //Parent class reference pointing to child class object
a.method3_static();
B b=new B();
b.method3_static();
b.method4_final();
System.out.println(b.name);
*//*
A a=new B();
a.method3_static();
B b=new B();
b.method3_static();
}
}
*/
/*
class A{
final String name;
//Final is used
}
*/
package learnining;
public class MainDemo{
public void add(int a,long b){
System.out.println("a method");
}
public void add(long a,byte b){
System.out.println("B method");
}
public static void main(String[] args) {
MainDemo obj=new MainDemo();
short a=1;
byte b=2;
//obj.add(a,b);
}
}