-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
42 lines (32 loc) · 885 Bytes
/
Copy pathApp.java
File metadata and controls
42 lines (32 loc) · 885 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
40
41
42
/*class Person {
//Declare variables
String name;
int age;
void speak() {
System.out.println("My name is: " + name + " and I am " + age + " years old!");
}
void sayHello() {
System.out.println("Hello there cutie!");
}
/* class has two things
* 1.Data (u can call variables)
* 2.Subrotines called methods, for example in our app class thereis main method
*/
/*
}
public class App {
public static void main(String[] args) {
Person person1 = new Person();
Person person2 = new Person();
person1.name = "Lipsa Jena";
person1.age = 27;
person1.speak();
person1.sayHello();
person2.name = "Yashpal Singh";
person2.age = 28;
person2.speak();
person2.sayHello();
System.out.println(person1.name + " is " + person1.age);
System.out.println(person2.name + " is " + person2.age);
}
}*/