OOPS Through JAVA
1. Program for printing the roots of Quadratic equation
In this program we are finding the roots of the quadratic equation. Dependsupon the value of the determinant we are printing the nature as well as thecorresponding roots. The particular part is explained below:
public static void main ( String args ) :
Every program begins with the main() method. All the Java applications begin execution by calling main(). The full meaning of each part of this is:
keyword is an access specifier, which allows the programmer tocontrol the visibility of class members. When a class member is preceded by
then that member may be accessed by code outside the class in which it isdeclared.
must be declared as public, since it must be called by codeoutside of its classe when the program is started.
to be called without having to instantiatea particular instance of the class. This is necessary since
main ( )
is called by theJVM before any objects are made.
simply tells the compiler that
main ( )
doesn’t return avalue.
String args [ ]:
main ( ) ,
there is only one parameter, albeit a complicated one.
String args [ ]
declares a parameter named args, which is an array of instances of theclass String.
receives any command-line arguments present when the programis executed.
Math . sqrt ( ):