Introduction to Java Flashcards

(70 cards)

1
Q

What is Java?

A

Java is a free-to-use and highly dynamic high-level programming language for coding programs such as web applications, mobile applications, enterprise software, big data applications, and server-side technologies.

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

Who created Java and when?

A

Java was created by Sun Microsystems in 1995.

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

What are the common uses of Java?

A

Common uses of Java include game development, cloud computing, big data, artificial intelligence (AI), and Internet of Things.

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

What is the Java Runtime Environment (JRE)?

A

The JRE is the software that Java programs require to run correctly, providing class libraries and other resources.

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

What are the advantages of using Java?

A

Advantages of using Java include active community support, high-quality learning resources, inbuilt functions and libraries, security, and platform independence.

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

What is the ‘Write Once, Run Anywhere’ (WORA) philosophy?

A

The WORA philosophy means that Java code can be written once and run on any underlying platform without rewriting.

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

What must a developer understand to use Java?

A

A developer must understand the Java Virtual Machine (JVM) and Java Language and APIs.

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

What is the Java Virtual Machine (JVM)?

A

The JVM is a virtual machine that runs Java applications as a run-time engine.

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

What are the two broad categories of programming languages?

A

The two broad categories are compilers and interpreters.

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

How do compilers work?

A

Compilers translate the entire code into machine language, converting the source code into a binary program of bytecode.

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

How do interpreters work?

A

Interpreters check the bytecode and execute the bytecode instructions line by line.

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

What is the role of the Java compiler?

A

The Java compiler converts the source code into a binary program of bytecode.

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

What is the role of the Java interpreter?

A

The Java interpreter checks the bytecode and communicates with the operating system, executing the bytecode instructions line by line.

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

What file extension do Java programming statements have?

A

Java programming statements are stored on a disk with a .java file extension.

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

What is a Virtual Machine in Java?

A

A Virtual Machine in Java is named java.exe.

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

What are Java APIs?

A

Java APIs (Application Programming Interface) are important software components bundled with the Java Platform.

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

What do Java APIs provide?

A

Java APIs provide pre-written Java programs that plug and play existing functionality into a code, such as getting the time and date, performing mathematical operations, or manipulating text.

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

How many keywords does the Java language have?

A

The Java language has only about 50 keywords.

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

How many classes and methods does the Java API have?

A

The Java API has several thousand classes, with thousands of methods that can be used in any program.

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

What is the best way to understand a programming language?

A

The best way to understand a programming language is by dissecting and examining its sample program.

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

What does the following Java program do? ‘System.out.println(“First Java Application”);’

A

It prints or displays ‘First Java Application’.

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

What is a class in Java?

A

A class is the basic unit of a Java program that defines a group of objects, including data members and methods.

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

What is the class name in the example program?

A

The class name in the example program is ‘Skeleton’.

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

What are the requirements for naming an identifier in Java?

A

An identifier must begin with a letter, underscore, or dollar sign, can include letters, digits, underscores, or dollar signs, is case-sensitive, cannot be true, false, or null, and cannot be a reserved word.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What are reserved words in Java?
Reserved words or keywords are special words significant to the Java compiler that cannot be used as variable names.
26
List some Java keywords.
Some Java keywords include: abstract, assert, boolean, break, byte, case, catch, char, class, const, continue, default, do, double, else, enum, extends, final, finally, float, for, goto, if, implements, import, instanceof, int, interface, long, native, new, package, private, protected, public, return, short, static, strictfp, super, switch, synchronized, this, throw, throws, transient, try, void, volatile, while.
27
What do braces identify in Java?
Braces are used to identify blocks of code and data.
28
What is required for braces in Java?
Braces require matching opening ({) and closing (}) braces.
29
Where should the definition of the class Skeleton be located?
The definition of the class Skeleton should be between the first opening brace and the last closing brace on line 5.
30
How many method definitions does the Skeleton class have?
The Skeleton class has one (1) method definition on line 2.
31
What is the purpose of the method in the Skeleton class?
The method is intended to improve the readability of the program.
32
What are the first three words in line 2 of the method definition?
The first three words are public static void.
33
What is the public keyword in Java?
The public keyword is a type of access or visibility modifier.
34
What does the static keyword indicate?
The static keyword indicates that this is a class method.
35
Why is the main method declared static?
The main method is always declared static so that it can be executed without creating an object of the class.
36
What does the void keyword mean?
The void keyword means that the main is a non-value-returning method.
37
What is the name of the method in Java?
The name of the method is main.
38
Where does execution begin in a Java program?
Execution must always begin with the main method.
39
What must all Java applications include?
All Java applications must include a class containing one (1) main method.
40
What is listed inside the parentheses after the method name?
Parameters are listed along with their types to allow the method to receive values.
41
What is the parameter of the main method?
The main method has a parameter called args, an array of type String.
42
What do the square brackets [] indicate in Java?
The square brackets [] indicate that args is an array.
43
What is an array in Java?
An array is a collection of similar data types.
44
What is a string in Java?
A string is a sequence of characters containing letters, numbers, and symbols.
45
When does the definition of the main method start and end?
The definition starts with an opening brace (end of line 2) and ends with a closing brace (line 4).
46
What does line 3 of the sample Java program contain?
Line 3 contains one (1) programming statement or command.
47
What is out in the context of Java?
Out is an object defined in the System class.
48
What is System in Java?
System is a class.
49
What is a literal string in Java?
A literal string is a series of characters that appear exactly as written and is always enclosed by double quotation marks (" ").
50
What are arguments in Java?
Arguments are information passed to a method so it can perform its task.
51
What does a Java statement command the compiler to do?
A Java statement commands the compiler what to do.
52
What is the purpose of comments in Java?
Comments provide additional information to make programs easier for programmers to understand.
53
Will comments be compiled and executed?
Comments will not be compiled and executed when the program is run.
54
How can a comment line start in Java?
A comment line can start with // symbols and continue to the end of the line.
55
What is a single-line comment in Java?
A single-line comment starts with //.
56
How can comments span multiple lines in Java?
Comments can be placed between /* and */ symbols if they run over multiple lines.
57
What does the Java Development Kit (JDK) include?
The JDK includes complete JRE tools for developing, debugging, and monitoring Java applications.
58
What must be installed to write, compile, and execute Java programs?
The JDK must be installed on the computer.
59
What is the first step to save a Java program?
Write the code in a text editor such as Notepad.
60
What is the sample Java program to be saved?
public class Demo { public static void main (String a []) { System.out . println("First program in Java") ; } }
61
How should the Java file be saved?
The file must be saved with double quotes ("Demo.java").
62
What should you do after saving the Java file?
Open the DOS window (cmd) and change the directory to where the Java file was saved.
63
How do you set the path of JDK?
Use the command: set path=%path%; [JDK bin directory].
64
What command is used to compile the Java program?
Use the command: javac [name of the Java file].java.
65
What command is used to execute the compiled Java program?
Use the command: java [name of the Java file].
66
What is the command prompt example for changing directory?
C:Windows\System32> cd C:\COPRO1
67
What is the command prompt example for setting the path?
C:\COPRO1> set path=%path%; C:\Program Files\Java\jdk 1.8.0_121\bin
68
What is the command prompt example for compiling a Java program?
C:\COPRO1> javac FirstJavaProgram.java
69
What is the command prompt example for executing a Java program?
C:\COPRO1> java FirstJavaProgram
70
What is the output of the first Java program?
First Java Application