From ggc
|
01 packagepackage is used to name the directory or folder a class is in intermediate;
02
03 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects Employee
04 {open braces start code blocks and must be matched with a close brace
05 privateprivate is used to restrict access to the current class only String name;
06
07 publicpublic is used to indicate unrestricted access (any other class can have access) Employee(String n)
08 {open braces start code blocks and must be matched with a close brace
09 name=this assignment operator makes the left side equal to the right siden;
10 }close braces end code blocks and must match an earlier open brace
11
12 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setName(String n)
13 {open braces start code blocks and must be matched with a close brace
14 name=this assignment operator makes the left side equal to the right siden;
15 }close braces end code blocks and must match an earlier open brace
16
17 publicpublic is used to indicate unrestricted access (any other class can have access) String getname()
18 {open braces start code blocks and must be matched with a close brace
19 returnreturn means to provide the result of the method and/or cease execution of the method immediately name;
20 }close braces end code blocks and must match an earlier open brace
21 }close braces end code blocks and must match an earlier open brace
|
Download/View intermediate/Employee.java