




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





System.out.println(2 + 2 % 2 - 2 * 2 / 2); System.out.println(1 / 4 + 1.0); System.out.println(2.0 / 4 + (int) 1.8);
BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in)); String s; do { System.out.println(“Give up?”); s = inFromUser.readLine(); } while (s != “yes”);
BufferedReader inFromUser = new BufferedReader( new InputStreamReader(System.in)); String s; int i = 0; while ((i!=1) || (i!=2) || (i!=3)) { System.out.println(“Enter either 1, 2, or 3”); s = inFromUser.readLine(); i = Integer.parseInt(s); }
int sum=0, ctr=1; while (ctr <= 10) sum = sum + ctr; ctr = ctr + 1;
class Stuff { public static void main(String[] args) { Stuff.Foo(); } public void Foo() { System.out.println(“Bah.”); } }
2 2
class Test { // The FindDistance method would be inserted here
// Sample main method public static void main(String[] args) { Test myObj = new Test(); // x1 = 0, y1=0, x2=3, y2= System.out.println(myObj.FindDistance(0,0,3,4); // x1 = -2, y1 =0, x2=3, y2= System.out.println(myObj.FindDistance(-2,0,3,5); } }