回答編集履歴

2

作文の修正。「です」が続きすぎなので...

2018/05/22 03:26

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -1,6 +1,6 @@
1
1
  System.outはSystemクラスのstaticフィールドで、型はPrintStreamです。
2
2
 
3
- printやprintlnは、SystemのメソッドではなくPrintStreamのメソッドす。
3
+ printやprintlnは、SystemではなくPrintStreamのメソッドとして定義されています。
4
4
 
5
5
  [クラスSystem - out](https://docs.oracle.com/javase/jp/8/docs/api/java/lang/System.html#out)
6
6
 

1

追記

2018/05/22 03:26

投稿

LouiS0616
LouiS0616

スコア35660

test CHANGED
@@ -3,3 +3,37 @@
3
3
  printやprintlnは、SystemのメソッドではなくPrintStreamのメソッドです。
4
4
 
5
5
  [クラスSystem - out](https://docs.oracle.com/javase/jp/8/docs/api/java/lang/System.html#out)
6
+
7
+
8
+
9
+ 要は、こう書いても良いということです。
10
+
11
+ ```Java
12
+
13
+ import java.io.PrintStream;
14
+
15
+
16
+
17
+ class Main {
18
+
19
+ public static void main(String[] args) {
20
+
21
+ PrintStream ps = System.out;
22
+
23
+ ps.println("hogehoge");
24
+
25
+ }
26
+
27
+ }
28
+
29
+ ```
30
+
31
+
32
+
33
+ **実行結果** [Wandbox](https://wandbox.org/permlink/dkht0msZwnx7QhiD)
34
+
35
+ ```
36
+
37
+ hogehoge
38
+
39
+ ```