Saturday, August 25, 2018

Java Questions For Selenium Webdriver Interview

| Saturday, August 25, 2018
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 illustration of java.io.PrintStream. This current is already opened upward as well as reach to get got output data.
  • println : is a method of java.io.PrintStream .It is an overloaded method.

22 : Write programme 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 programme to larn lawsuit of 52+42-32+22-1 

Answer :
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 musical note method? 

Answer : It volition supply double object array “Object[][]”.

25 : int x=10 as well as 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 + " as well as y = " + y);    x = x + y;   y = x - y;   x = x - y;    System.out.println("After swapping x = " + x + " as well as y = " + y);  } }

Related Posts