Professional Documents
Culture Documents
method. The main() method is static so that JVM can invoke it without instantiating the
class. This also saves the unnecessary wastage of memory which would have been
used by the object declared only for calling the main() method by the JVM.
Void: It is a keyword and used to specify that a method doesn’t return anything. As
main() method doesn’t return anything, its return type is void. As soon as the main()
method terminates, the java program terminates too. Hence, it doesn’t make any sense
to return from main() method as JVM can’t do anything with the return value of it.
main: It is the name of Java main method. It is the identifier that the JVM looks for as
the starting point of the java program. It’s not a keyword.
String[] args: It stores Java command line arguments and is an array of type
java.lang.String class. Here, the name of the String array is args but it is not fixed and
user can use any name in place of it.
------------------------------------------------------------------------------------------------------------
Java Development Kit (JDK) is a software development environment used for
developing Java applications and applets. It includes the Java Runtime Environment
(JRE), an interpreter/loader (Java), a compiler (javac), an archiver (jar), a documentation
generator (Javadoc), and other tools needed in Java development.
Now we need an environment to make a run of our program. Henceforth, JRE stands for
“Java Runtime Environment” and may also be written as “Java RTE.” The Java Runtime
Environment provides the minimum requirements for executing a Java application; it
consists of the Java Virtual Machine (JVM), core classes, and supporting files.
1. JDK (Java Development Kit) is a Kit that provides the environment to develop and
execute(run) the Java program. JDK is a kit(or package) that includes two things
● Development Tools(to provide an environment to develop your java
programs)
● JRE (to execute your java program).
3. JVM (Java Virtual Machine) is a very important part of both JDK and JRE because it
is contained or inbuilt in both. Whatever Java program you run using JRE or JDK goes
into JVM and JVM is responsible for executing the java program line by line, hence it is
also known as an interpreter.
JVM, JRE, and JDK are platform dependent because the configuration of each OS is
different from each other. However, Java is platform independent.
------------------------------------------------------------------------------------------------------------
Abstraction in Java
------------------------------------------------------------------------------------------------------------
What is instance variable in Java?
Instance variables in Java are non-static variables which are defined in a class outside
any method, constructor or a block. Each instantiated object of the class has a separate
copy or instance of that variable. An instance variable belongs to a class.
Features of an instance variable?
The life of an instance variable depends on the life of an Object, i.e., when the object is
created, an instance variable also gets created and the same happens when an object is
destroyed.
------------------------------------------------------------------------------------------------------------
What is Static Variable in Java?
Static variable in Java is a variable which belongs to the class and initialized only once
at the start of the execution. It is a variable which belongs to the class and not to
object(instance ). Static variables are initialized only once, at the start of the execution.
These variables will be initialized first, before the initialization of any instance variables.
● A single copy to be shared by all instances of the class
● A static variable can be accessed directly by the class name and doesn’t need
any object
<class-name>.<variable-name>
------------------------------------------------------------------------------------------------------------
What is Static method in Java?
Static method in Java is a method which belongs to the class and not to the object. A
static method can access only static data. It is a method which belongs to the class and
not to the object(instance). A static method can access only static data. It cannot
access non-static data (instance variables).
● A static method can call only other static methods and can not call a non-static
method from it.
● A static method can be accessed directly by the class name and doesn’t need
any object
● A static method cannot refer to “this” or “super” keywords in anyway
<class-name>.<method-name>
Interface - webdriver
Webdriver classes :
Webdriver methods: