Basic Questions Flashcards

1
Q

Is Java platform independent?

A

Yes. We can write java code on one platform and run it on another platform.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain public static void main(String args[])

A

Here public is an access modifier, which means that this method is accessible by any class.

static – static keyword tells that this method can be accessed without creating the instance of the class. Refer: Static keyword in java

void – this main method returns no value.

main – It is the name of the method.

String args[] – The args is an array of String type. This contains the command line arguments that we can pass while running the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is javac ?

A

javac produces the java byte code from the source code written *.java file. JVM executes the bytecode to run the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is class?

A

A class is a blueprint or template or prototype from which you can create the object of that class. A class has set of properties and methods that are common to its objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the base class of all classes?

A

java.lang.Object is the base class (super class) of all classes in java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a wrapper class in Java?

A

A wrapper class converts the primitive data type such as int, byte, char, boolean etc. to the objects of their respective classes such as Integer, Byte, Character, Boolean etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a path and classPath in Java?

A

Path specifies the location of .exe files. Classpath specifies the location of bytecode (.class files).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Different Data types in Java

A
byte – 8 bit
short – 16 bit
char – 16 bit Unicode
int – 32 bit (whole number)
float – 32 bit (real number)
long – 64 bit (Single precision)
double – 64 bit (double precision)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is Unicode?

A

Java uses Unicode to represent the characters. Unicode defines a fully international character set that can represent all of the characters found in human languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are Literals?

A

Any constant value that is assigned to a variable is called literal in Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an Array?

A

An array is a collection (group) of fixed number of items. Array is a homogeneous data structure which means we can store multiple values of same type in an array but it can’t contain multiple values of different types. For example an array of int type can only hold integer values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is BREAK statement in java?

A

The break statement is used to break the flow sequence in Java.

break statement is generally used with switch case data structure to come out of the statement once a case is executed.
It can be used to come out of the loop in Java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

byte

A

8 bit integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

short

A

16 bit integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

char

A

16 bit unicode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

int

A

32 bit integer

17
Q

float

A

32 bit real number

18
Q

long

A

64 bit integer

19
Q

double

A

64 bit real number

20
Q

boolean

A

true/false