Part 5
21 : Explain System.out.println();
Answer :
- System : is a concluding shape in java.lang package.
- out : is a static fellow member of arrangement class. It is an lawsuit of java.io.PrintStream. This current is already opened upwards too own to convey output data.
- println : is a method of java.io.PrintStream .It is an overloaded method.
22 : Write plan to print fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21,...
Answer :
public shape fibonaccci { world static void main(String[] args) { int f1 = 0; int f2 = 1; int amount = 0; for(int i=0; i<=21;){ System.out.println(f1); amount = i+f2; f2=i; f1=sum; i=f1; } } }
23 : Write plan to larn lawsuit of 52+42-32+22-12
Answer :
24 : What is supply type of testng @DataProvider notation method?
public shape SquareSum { world static void main(String[] args) { int amount = 0; for (int i=5;i>=1;i--){ if(i%2!=0){ if(sum<(i*i)){ amount = (i*i)-sum; }else{ amount = sum-(i*i); } }else{ amount = sum+(i*i); } } System.out.println(sum); } }
24 : What is supply type of testng @DataProvider notation method?
Answer : It volition supply double object array “Object[][]”.
25 : int x=10 too y=20. Swap both variable values without using whatever temp variable.
Answer :
public shape swapNumbers { world static void main(String[] args) { int x = 10; int y = 20; System.out.println("Before swapping x = " + x + " too y = " + y); x = x + y; y = x - y; x = x - y; System.out.println("After swapping x = " + x + " too y = " + y); } }