-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathUser.java
More file actions
34 lines (25 loc) · 705 Bytes
/
Copy pathUser.java
File metadata and controls
34 lines (25 loc) · 705 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
//<---------------------------STEP1:DEFINE THE FIELDS------------------------------>
/*
public class User
{
public String firstName;
public String lastName;
}
*/
//<--------STEP2:DEFINE THE METHODS WITH THE APPROPRIATE RETURN TYPE AS A KEYWORD PLACED BEFORE THE NAME AND AFTER THE ACCESS MODIFIER-------->
public class User
{
public String firstName;
public String lastName;
/* The bottom code will error because we declared it as a void meaning
We do not want anything to be returned to us*/
/*
public void output(){
return "Hi, my name is "+ firstName + " " + lastName + ".";
}
*/
public String output()
{
return "Hi, my name is "+ firstName + " " + lastName + ".";
}
}