Java

JAVA PROGRAM TO PRINT 1 TO 100 WITHOUT LOOP

          Approach:   Using  Recursion      public  class   PrintNumbers{    static  void   printNumbers(int  initial , int  last ) {        if(initial<=last){           System.out.println(initial+” ” );             printNumbers(initial+1,last);     }   }   public  static   void  main(String  args[]) { […]

JAVA PROGRAM TO PRINT 1 TO 100 WITHOUT LOOP Read More »

Java Program to Find the Sum of First N Odd & Even Numbers

  Numbers  which  are  divisible  by  2  are  called  even  numbers (ending  with  0 ,2,4,6,8 ),  while  numbers  that  are  not  divisible  by  2  are  called  odd  numbers (ending  with 1, 3,5,7,9 )      Example : 9    Output :   Sum  of  First  9  Even  Numbers = 2+4+6+8+10+12+14+16+18=90  Sum  of  First  9  Odd 

Java Program to Find the Sum of First N Odd & Even Numbers Read More »

JAVA PROGRAM TO CALCULATE THE SUM OF ODD NUMBERS

  Numbers  that  are   divisible  by  2  are  called  Even  numbers(ending  with 0,2,4,6,8), while  numbers  that  are  not  divisible  by  2  are  called  odd  numbers(which  are  ending  with  1,3,5,7,9)     Example:   Input: 5 Output:     Sum  of   Odd  Numbers present  from number  1  to  5 =1+3+5=9 Sum  of  Even  Numbers  present  from 

JAVA PROGRAM TO CALCULATE THE SUM OF ODD NUMBERS Read More »

JAVA PROGRAM TO FIND THE FACTORIAL OF A NUMBER

  The  factorial   of  a   number   is    the   multiplication  of  all  positive  integers  from  1   to  that  number .      Factorial  of  number  n   is  represented  as  n!         Formula  for  Factorial :     n!=n*(n-1)*(n-2)*(n-3)*……………*1   Example :  5!=5*4*3*2*1=120 6!=6*5*4*3*2*1=720           Iterative  Approach :  

JAVA PROGRAM TO FIND THE FACTORIAL OF A NUMBER Read More »

JAVA PROGRAM TO FIND THE SUM OF THE DIGITS OF A NUMBER

  Example :  Input: 987 Output: 9+8+7=24     Java program   public  class  SumofDigits {          public  static   void   main(String  args[] ) {          int  num, digit,sum=0;          Scanner  sc=new  Scanner(System.in);          System.out.println(“Enter  a  number “);          int   num=sc.nextInt();

JAVA PROGRAM TO FIND THE SUM OF THE DIGITS OF A NUMBER Read More »

JAVA PROGRAM TO PRINT THE PRIME NUMBERS FROM 1 TO N.

            A  prime  number  is  a  whole  number greater  than  1  which  is  only  divisible  by  1  &  the  number  itself i.e. A  prime  number  can’t  be  divided  by  other  numbers  except  1  &  the  number   itself.   e.g. 2,3,5,7,11,13,17,19 …..etc.       Approach : According  to  definition, number

JAVA PROGRAM TO PRINT THE PRIME NUMBERS FROM 1 TO N. Read More »

JAVA PROGRAM TO CHECK IF TWO STRINGS ARE ANAGRAM OR NOT

  Two   Strings  are  said  to   be   anagram   if   you   can  form  one  string   by  arranging  the  characters   of  another  string .  For  example :  Earth  and  Heart , Care  and  Race, Keep  and Peek  etc.       Approach :   In  this  approach ,  the  idea  is  that  if  two  strings  are  anagram,

JAVA PROGRAM TO CHECK IF TWO STRINGS ARE ANAGRAM OR NOT Read More »

HOW TO HANDLE DYNAMIC ELEMENTS IN SELENIUM

  Dynamic  elements  are  web  elements  which  are  dynamically   generated   during  runtime .  Dynamic  identifiers  can  be  for  any  web elements  of  the  web  page  but  normally  used  for  buttons ,  text fields  etc.     e.g. <button  id=”Submit-901″/> <button  id=”Submit-902″/> <button  id= “Submit-903″/>     Handling  dynamic  ekements  in  Selenium  involves  using  flexible  locators  and 

HOW TO HANDLE DYNAMIC ELEMENTS IN SELENIUM Read More »

SYNCHRONIZATION IN SELENIUM

  Synchronization  in  Selenium  is  the  process   of  matching  the   execution  speed  of  the  test  script  with  the  loading   speed   of  the  application   under  test .  Synchronization  prevents  errors  such  as  NoSuchElementException   .           How  to  achieve  synchronization   in  the  Selenium   WebDriver ?     Synchronization  in  selenium  is  very  important 

SYNCHRONIZATION IN SELENIUM Read More »

SELENIUM XPATH

    XPath (XML Path  )  is  a  powerful  Selenium  locator   strategy  which   are  used  to  navigate  and    find   elements   in  a   web    page’s   HTML   structure .        What  is  XPath?     Xpath  is  XML  Path  language  which  is  an  expression  language  that   is  used   to   find  the  web  elements

SELENIUM XPATH Read More »