Sunday 10 January 2021

A simple Java program with multiple statements

 Code :


class SquareRoot

{

  public static void main(String args[])

  {

    double x = 5;                 // Declaration and initialization

      double y;                     // Simple declaration

      y = Math.sqrt(x);

      System.out.println("y = " + y);

  }

}


Output : 




No comments:

Post a Comment