结对review

1 public class Something {
2 void doSomething () 
3 {
4 private String s = "";
5 int l = s.length();
6 }
7 }
 1 interface Playable {
 2 void play();
 3 }
 4 interface Bounceable {
 5 void play();
 6 }
 7 interface Rollable extends Playable, Bounceable {
 8 Ball ball = new Ball("PingPang");
 9 }
10 class Ball implements Rollable {
11 private String name;
12 public String getName() {
13 return name;
14 }
15 public Ball(String name) {
16 this.name = name; 
17 }
18 public void play() {
19 ball = new Ball("Football");
20 System.out.println(ball.getName());
21 }
22 }
1 public class Something {
2 public int addOne(final int x) {
3 return ++x;
4 }
5 }

问题:1.局部变量前不能加修饰符 

2.在接口中定义的常量还是方法,前面都要修饰

3.被final修饰,不能被修改

 
 
posted @ 2017-03-24 17:05  哦吧碎碎  阅读(127)  评论(0编辑  收藏  举报