質問するログイン新規登録

回答編集履歴

1

ソース修正

2015/07/26 05:17

投稿

cateye
cateye

スコア6851

answer CHANGED
@@ -3,39 +3,20 @@
3
3
  であれば、mainから呼び出すだけで使えませんか?
4
4
  以下、参考・・
5
5
  ```java
6
- class Personality
6
+ public class JavaApplication12 {
7
- {
7
+
8
- boolean l2r;
9
- String firstName;
10
- String familyName;
11
- int age;
12
- //
13
- String getFullName()
8
+ private static String msg(){
14
- {
15
- if( l2r ){
16
- return firstName + " " + familyName;
9
+ return "こんにちは^^";
17
- }
18
- return familyName + " " + firstName;
19
10
  }
20
- }
21
-
22
- public class JavaApplicationTest {
23
-
24
11
  /**
25
12
  * @param args the command line arguments
26
13
  */
27
- public static void main(String[] args)
14
+ public static void main(String[] args) {
28
- {
29
15
  // TODO code application logic here
30
- Personality person1 = new Personality();
31
- person1.l2r= true;
32
- person1.firstName= "AAA";
33
- person1.familyName= "BBB";
34
- person1.age= 33;
35
- //
36
- System.out.println("フルネームは" + person1.getFullName());
16
+ System.out.println(msg());
37
17
  }
38
- // End of main.
18
+
39
19
  }
40
20
 
21
+
41
22
  ```