-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssignment107_.java
More file actions
38 lines (26 loc) · 810 Bytes
/
Assignment107_.java
File metadata and controls
38 lines (26 loc) · 810 Bytes
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
package abhilash_Asignments;
//WAP using upcasting concept?
class NewOne // NEW Parent class
{
void numbers() // Non-static Methods there will be ony this methods in "upcasting"
{
System.out.println("this is numbers");
}
void alphabets() {
System.out.println("this is alphabets");
}
}
public class Assignment107_ extends NewOne // sub class get releation with parent class
{
void Hindi() {
System.out.println("this is Hindi");
}
public static void main(String[] args) // Main method
{
NewOne N1 = new Assignment107_(); // creating upcasting for the parent method
N1.numbers(); // Accessing the parent class method with help of variable given .
N1.alphabets();
// N1.Hindi(); //we cannot access the child class method with out creating the
// object to the child class
}
}