class A1{ int x1; int x2; A1(int x1, int x2){ this.x1 = x1; this.x2 = x2; } int methodA(){ return x1 + x2; } } class B1{ int x1; int x2; B1(int x1, int x2){ this.x1 = x1; this.x2 = x2; } int methodB(){ return x1 + x2; } } public class Open1A{ A1 a1 = new A1(7,7); B1 b1 = new B1(7,7); int ex1 = this.a1.methodA(); int ex2 = this.b1.methodB(); } //Program Output: //----------------------------------- //jpdesilva@Juans-MacBook-Pro cse11-pa3-starter-main % ./run Open1A.java //Tester Library v.3.0 //----------------------------------- //Tests defined in the class: Open1A: //--------------------------- //Open1A: //--------------- //new Open1A:1( //this.a1 = new A1:2( ///his.x1 = 7 // this.x2 = 7) //this.b1 = new B1:3( // this.x1 = 7 // this.x2 = 7) //this.ex1 = 14 //this.ex2 = 14) //--------------- //No test methods found.
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter