0 LIKES LikeUnLike
class Start{ int x; int go(int n){x+=n;return x;} void print(){ System.out.println("Start: "+x); }}class Finish extends Start{ int go(int n){x-=n;return x;} void print(){ System.out.println("Finish: "+x); } }public class Class1{ public static void main (String[] args) { Start s1=new Start(), s2= new Finish(), s3= new Finish(){ int go(int n){x+=2*n;return n;} }; s1.go(s2.go(s3.go(s2.go(s1.go(3))))); s1.print();s2.print();s3.print(); }}
Tags:
Report (0) (0) | earlier
Latest activity: earlier. This question has 1 answers.