Skip to content

Commit bac0589

Browse files
author
Suresh Shrestha
committed
Class #1 Accessing default method.
1 parent d2832d6 commit bac0589

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ hs_err_pid*
1919
.project
2020
**/.settings/*
2121
*.classpath
22-
**/target/**
22+
**/target/**
23+
/bin/
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.lftechnology.phpjava;
2+
3+
import com.lftechnology.phpjava.one.Boy;
4+
//import com.lftechnology.phpjava.one.Girl;
5+
6+
/**
7+
*
8+
* @author Suresh Shrestha <sureshshrestha@lftechonology.com>
9+
*
10+
*/
11+
public class Accessor {
12+
13+
public static void main(String[] args) {
14+
// TODO Auto-generated method stub
15+
System.out.println("Accessor main method.");
16+
String oneObj = Boy.getBoy();
17+
Boy BoyObj = new Boy();
18+
BoyObj.getGender();
19+
20+
}
21+
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.lftechnology.phpjava.one;
2+
3+
/**
4+
*
5+
* @author Suresh Shrestha <sureshshrestha@lftechonology.com>
6+
*
7+
*/
8+
public class Boy {
9+
10+
public static String getBoy() {
11+
// TODO Auto-generated method stub
12+
System.out.println("Hello, I am a boy.");
13+
return "hello Boy";
14+
}
15+
16+
public void getGender() {
17+
System.out.println("Male");
18+
return;
19+
}
20+
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.lftechnology.phpjava.one;
2+
3+
/**
4+
*
5+
* @author Suresh Shrestha <sureshshrestha@lftechonology.com>
6+
*
7+
*/
8+
class Girl {
9+
10+
public static void getGirl(String[] args) {
11+
// TODO Auto-generated method stub
12+
System.out.println("Hello, I am a girl.");
13+
14+
}
15+
16+
private static void getHair(String[] args) {
17+
System.out.println("Hair is long.");
18+
}
19+
20+
}

0 commit comments

Comments
 (0)