What Are The Pros and Cons of Java?: Java Is The Queen of Programming Languages. It Beholds The Pride of The

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

1. Why java? Why not other programming languages?

 Over the years Java has maintained its position in the top 3 programming
Languages and beholds the pride of the most preferred programming
language by the software developers.
 It is one of the most effected and powerful languages and it is the most
widely used programming language in different areas.
 Java is more stable compared to other languages and the newer version of
java released with more features makes more stable
 It is a high-level programming and platform independent language that is
written once and run anywhere (WORA). The byte code produced by the
compiler can be used in any machine that supports Java virtual machine.
 Finally, it is Object oriented programming language which helps us to use
the reusability of code in other programs and allows to create modular
programs.

 Java is the Queen of programming languages. It beholds the pride of the
most preferred programming language by
2. What are the pros and cons of Java?

A.

3. Where has java been used?


A. Most of the developers uses java to develop
 Mobile applications
 Artificial intelligence
 Web applications
 Big data technology
 Gaming applications
 Business applications

4. How does JVM work?


♦ JVM is known as java virtual machine, and it is the ones that actually calls
the main method present in java code.
♦ It is the part of Java Runtime Environment
♦ The compiler which produces the class file of a java file goes into various
steps when we run. These whole steps are done by the JVM.

5. What is the use of the main method?


 To execute the other methods which are present in the same class, the main
method is needed.
 JVM always calls main method, to execute the other methods by writing the
syntax of calling a method we can execute by writing it in the main method.

6. Explain about variable?


 It is known as container that saves the data values
 Declaration of a variable
: datatype variablename
 Types of variables:
Static variable: Variables that are declared outside the class with the use of
Keyword called static variable (or) class variable.
 It can be accessed by any method and any class.
Non-static variable: Variables that are declared outside the class without

2
Any keyword (or) Instance variable.
 To use the non-static variable, we need to create the object.
 It can be accessed by any method and any class with the help of class
and object creation.
Local variable: Variables that are declared inside the class are called local
variables
 These can be used only in the class where it is declared.
 Without assigning the variable we can't use it.
 For both static and non-static variables even without assigning the data we
can use it.

7. Explain about Scanner?


 It is a built-in class containing non-static method.
 To use this, we need to import it.
import java.util.Scanner;
 To use this non-static method, we need to create object.
 Except char we can scan all the type of data values.
8. Explain about

SYNTAX:
 Variable:
Static variable:
classname.variablename
Object.staticmember
Non-Static Variable:
object.non-staticmember
 Object creation:
classname variable =new classname();

3
 For method:
Static method:
 No need to create the object
className.methodName(args);
Non-static method:
 Needs to create the object
classname variable =new classname();
variable.methodname(args);
Main method:
classname.main(null);
 Scanner:
Scanner scn=new Scanner (System.in);
String s=scn.next();
String s=scn.nextLine();
int a=scn.nextInt();
 IF:
if (cond)
{
body of the program.
}
else if (cond)
{
body of the program
}
else
{
}

4
 Switch
switch(exp)
{
case 1:
body of the program
case 2:
body of the program
}

You might also like