-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathGlass.java
More file actions
39 lines (29 loc) · 818 Bytes
/
Glass.java
File metadata and controls
39 lines (29 loc) · 818 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
39
class CarCompany{
class Car{
String carType = "Electric";
String color = "Black";
int engineNo = 1776;
int capacity = 133;
static int noOfWheels= 4;
void display(){
System.out.print("Inside desplay ( ) method of nested class ");
System.out.println("Car Type is : " + carType);
System.out.println("Color is is : " + color);
System.out.println("Engine no is : " + engineNo);
System.out.println("Capacity is : " + capacity);
System.out.println("Number of wheels is : " + noOfWheels);
}
}// Inner class is closed here
public void outerDisplay( ){
System.out.println("Calling nested class Display method ");
Car sedan = new Car();
Car hatchback = new Car();
sedan.display();
}
}
class Glass{
public static void main(String args [] ){
CarCompany myCompany= new CarCompany();
myCompany.outerDisplay();
}
}