-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUser.java
41 lines (33 loc) · 912 Bytes
/
User.java
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
public abstract class User
{
private String firstName;//fieldA
private String lastName;//fieldB
public static void log(Object o)
{
System.out.print(o);
}
public static void logln(Object o)
{
System.out.println(o);
}
//Remember this is an abstract class which means
//we will not be invoking the constructor directly
//Which means to not call it within our calling program
//But in our Student Class
//I create a User Constructor
public User(String fName, String lName)
{
//Remember fieldName=parameterName
//NOTTT parameterName=fieldName
firstName=fName;
lastName=lName;
}
public final void sayHello()
{
logln(firstName+ " " + lastName);
}
}
//Remember this is an abstract class which means
//we will not be invoking the constructor directly
//Which means to not call it within our calling program
//But in our Student Class