Automation QA Testing Course Content

Java Excercise - 7

1)Write 3 different methods in Practice class execute those methods under main() method?

static method1
int x = 1; int y = x*2; int z = 5*y*y + 2*y + 3;

non static method2
int a = 5; int b = 1; int c = (a-b) * (a+b);

nonstatic method3
int i = 64; int j = i/8; int k = j/4; int l = k*3;

static method4
String s = "123 + 456";
String str = "Amigo" + " is the best";
int x = 333; String s4 = "Amigo" + x;
String s1 = "Rain"; String s2 = "In"; String s3 = s1 + s2 + "Spain";
String s5 = "My favorite movie is"; String s6 = "Route"; int roadNumber = 66; String text = s5 + " " + s6 + " " + roadNumber;
System.out.println("A man's gotta do what a man's gotta do");
System.out.println("Amigo" + " " + "is the best!");

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.