Part 2 Flashcards

1
Q

What command (CLI) can we use to run a Java application?

A

java

eg: $ java Main

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

What command (CLI) we can use to compile Java source code to bytecode and create a class file?

A

javac

eg: $ javac Main.java

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

What command (CLI) we can use to disassemble one or more class files?

A

javap

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

What command (CLI) we can use to create JMOD files and list the content of existing JMOD files?

A

jmod

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

What command (CLI) we can use to generate HTML pages of API documentation from Java source files?

A

javadoc

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

How we can check with command (CLI) the java version?

A

java -version

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

What command we can use to manage a keystore(database) of cryptographic keys?

A

keytool

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

How we can sign and verify Java Archive files (JAR)? (CLI)

A

jarsigner

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

What command (CLI) we can use to read and write a plain text policy file based on user input through the utility GUI?

A

policytool

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

What command (CLI) we can use to start a graphical console to monitor and manage Java applications?

A

jconsole

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

What command we can use to list the instrumented JVMs on the target systems?

A

jps

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

What command we can use to launch Java Mission Control (JMS) - profiling monitoring diagnostics tool suite?

A

jmc

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

What compiler’s javac command line option defines directory paths in search of classes?

A

javac -classpath

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

What interpreter’s command line option defines directory paths to use at runtime?

A

java -classpath

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

What interpreter’s command line option we can use to set a system property value, what is its syntax?

A

java -D

java -Dproperty=value

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

What command line option can be applied either to interpreter or compiler to print out the tool’s usage information?

A

java -h

17
Q

Which are the only applicable access modifiers for top level class?

A

public, , final, abstract, strictfp

18
Q

Which are the applicable access modifiers for inner classes?

A

public, , final, abstract, strictfp, private, protected, static

19
Q

What is it mean when a class is declared as public?

A
If a class is declared as public that we can access that class from anywhere, within the package or outside the package. 
public class Text {..}
20
Q

What is it mean when the class declaration doesn’t content any access modifier?

A
If class doesn't include any modifier in declaration, it has the default modifier that means that class is accessible only within the same package. 
class Text {..}
21
Q

What can be declared as final in java code?

A

Final is modifier applicable for classes, methods and fields.

22
Q

What is it mean when class is declared as final?

A
If class is declared as final then we can’t create the child class, the inheritance concept is not applicable for final classes. 
public final class Text {..}
Every method that is presented inside final class is always final by default whether we are declaring it or not. 
But every variable inside final class need not to be final. 
The final methods cannot be overriden in child class.
23
Q

What is it meant when method is declared as final?

A

The final methods cannot be overriden in child class.

24
Q

What kind of methods the final class can contain?

A
Every method that is presented inside final class is always final by default whether we are declaring it or not. 
But every variable inside final class need not to be final.
25
Q

What is it mean when the instance variable is declared as final?

A

If the instance variable is declared as the final compulsory we should perform initialization explicitly and JVM won’t provide any default values.
Rule: For the final instance variables we should perform initialization before constructor completion, otherwise we will get compile-time error.

26
Q

What is it mean when the variable is declared as final static?

A
If the value of a variable is not varied from object to object such type of variable is not recommended to declare as the instance variables. We have to declare those variables at class level by using static modifier. 
In case of instance variable for every object a separate copy will be created but in the case of static variable a single copy will be created at class level and shared by every object of that class. 
For the static variables it is not required to perform initialization explicitly, jvm will provide default values. 
If the static variable is declared as final the compulsory we should perform initialization explicitly, jvm won't provide any default value. 
Rule: For the final static variables we should perform initialization before class loading completion, otherwise we will get compile time error. 
Initialization inside static block is allowed:
class Test {
  final static int=10; // this is ok 
} 
class Test {
  final static int i; 
  static {
    i = 10;  // inside static block is ok 
  }
}
27
Q

What can be declared with abstract modifier?

A

Abstract modifier can be used for classes and methods only (not for members.)

28
Q

What can be declared with abstract modifier?

A

Abstract modifier can be used for classes and methods only (not for members.)

29
Q

What is it mean when class is declared as abstract?

A
Abstract modifier can be used for classes and methods only (not for members.) 
abstract class - it means it is not complete or partially implemented class 
it is not possible to create an object of that abstract class, so abstract class cannot be instantiated.
30
Q

Has to abstract class contain abstract methods?

A

Abstract class can contain 0 abstract methods, if there are no abstract methods inside the class, that class can still be declared as abstract.

31
Q

Has to class be declared as abstract, if the class contains only one abstract method?

A

If class contents at least one abstract method, it needs to be declared as abstract.