質問編集履歴

2

timer class のダブルコロンの使い方について

2016/12/16 06:16

投稿

datuota00
datuota00

スコア20

test CHANGED
File without changes
test CHANGED
@@ -442,10 +442,48 @@
442
442
 
443
443
  }
444
444
 
445
-
446
-
447
445
  ```
448
446
 
449
447
  ###
450
448
 
451
449
  上のプログラムはmvcモデルで構築しています。
450
+
451
+
452
+
453
+ ###追加の質問
454
+
455
+
456
+
457
+
458
+
459
+ ```
460
+
461
+ timer = new Timer(1000,this::expired);
462
+
463
+ ```
464
+
465
+ のところですが、調べてみて"::"の使い方は理解できたのですが、コンパイルがここだけできないです。エラー文は
466
+
467
+ ```
468
+
469
+ View5.java:63: エラー: ')'がありません
470
+
471
+ timer = new Timer(1000,this::expired);
472
+
473
+ ^
474
+
475
+ View5.java:63: エラー: 式の開始が不正です
476
+
477
+ timer = new Timer(1000,this::expired);
478
+
479
+ ^
480
+
481
+ View5.java:63: エラー: ';'がありません
482
+
483
+ timer = new Timer(1000,this::expired);
484
+
485
+
486
+
487
+ ```
488
+
489
+ となっています。javaのバージョンの問題でしょうか。

1

entiredでなくexpiredですね、すいません

2016/12/16 06:16

投稿

datuota00
datuota00

スコア20

test CHANGED
File without changes
test CHANGED
@@ -130,7 +130,7 @@
130
130
 
131
131
  this.model=model;
132
132
 
133
- timer = new Timer(1000, this::entired);
133
+ timer = new Timer(1000, this::expired);
134
134
 
135
135
  timer.setRepeats(true);
136
136
 
@@ -196,7 +196,7 @@
196
196
 
197
197
 
198
198
 
199
- void entired(ActionEvent ev/*actionEventでもだめだした*/) {
199
+ void expired(ActionEvent ev/*actionEventでもだめだした*/) {
200
200
 
201
201
  flushFlag = !flushFlag;
202
202