MODULE 1: Lesson 2 Flashcards

1
Q

Who created Java?

A

James Gosling, Mike Sheridan, and Patrick Naughton of Sun Microsystems.

## Footnote

Java was created in 1991.

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

What was Java initially called?

A

Oak.

The first project developed using Java was a personal
hand-held remote control named Star7.

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

What are some important Java applications?

A
  • Developing Android Apps
  • Creating Enterprise Software
  • Mobile Java Applications
  • Programming Hardware devices
  • Server-Side Technologies like Apache, JBoss, GlassFish, etc.

Gosling et al. realized that Java could be used for Internet programming.

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

What is source code?

A

Source code is a human-readable language used by Java Programmers to write programs.

Example: public class HelloWorld { public static void main(String[] args) { System.out.println(“Hello, World!”); }}

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

What does Java Architecture combine?

A

Java Architecture combines the process of compilation and interpretation to explain the various processes involved in formulating a Java program.

Example: Java programs are first compiled into bytecode and then interpreted by the Java Virtual Machine.

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

What are the components of Java programming language?

A

The components of Java programming language include Source Code, Java Compiler, Byte Code, and Java Virtual Machine (JVM).

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

What is the role of Java Virtual Machine (JVM)?

A

Java Virtual Machine (JVM) provides a runtime environment to drive Java Code or applications. It converts Java bytecode into machine language. JVM is a part of the Java Runtime Environment (JRE).

Example: JVM ensures that Java programs can run on any platform that has a JVM installed.

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

Why JVM?

A

JVM provides a platform-independent way of executing Java source code.

WORA Once you run a Java program, you can run on any platform and save lots of time.

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

What is JIT in JVM?

A

JVM comes with JIT (Just-in-Time) compiler that converts Java source code into low- level machine language. Hence, it runs faster than a regular application.

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

What is JRE?

A

JRE is a piece of software that is designed to run other software. It contains the class libraries, loader class, and JVM. If you are not a programmer, you don’t need to install JDK, but just JRE to run Java programs.

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

Why use JRE?

A

JRE Contains class libraries, JVM, and other supporting files. It does not include any tool for Java development like a debugger, compiler, etc.

It uses important package classes like math, swing, util, lang, awt, and runtime libraries. If you have to run Java applets, then JRE must be installed in your system.

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

What is JDK?

A

JDK is a software development environment used for making applets and Java applications.

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

Where can Java developers use JDK?

A

Java developers can use JDK on Windows, macOS, Solaris, and Linux.

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

What does the compiler in JDK do?

A

Compiler converts code written in Java into byte code.

Example sentence: The compiler in JDK translates Java code into a format that can be executed by the Java Virtual Machine.

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

What tools are included in JDK?

A

JDK includes a compiler, Java application launcher, Appletviewer, etc.

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

What is the relationship between JDK, JRE, and Development Tool?

A

JDK = JRE + Development Tool
JRE = JVM + Library Classes

17
Q

What does Java SE offer?

A

Java SE’s API offers the Java programming language’s Core functionality. It defines all the basis of types and objects to high-level classes.

18
Q

What is the purpose of Java ME platform?

A

The Java ME platform offers an API and a small-footprint virtual machine running Java programming language applications on small devices, like mobile phones.

Additional information: Java ME is designed for embedded systems and mobile devices.

19
Q

What does Java EE platform offer?

A

The Java EE platform offers an API and runtime environment for developing and running highly scalable, large-scale, multi-tiered, reliable, and secure network applications.

20
Q

What is JavaFX?

A

JavaFX is a platform for developing rich internet applications using a lightweight user-interface API.

21
Q

What are the sections involved in a Java program?

A

Package Statement
Import Statements
Class Definition
Main Method Class

A Java program involves the following sections: Package Statement, Import Statements, Class Definition, Main Method Class

22
Q

What does a package statement do in a Java program?

A

It declares a package with any name, which is a group of classes defined by a name. It is optional and tells the compiler that a package has been created.

You can create a package with any name. A package is a group of classes that are defined by a name.

23
Q

What is the main method in a Java program?

A

The main method is the starting point of a Java program and is essential. It may be the only class that defines the main method. Methods contain data type declaration and executable statements.

Every Java stand-alone program requires the main method as the starting point of the program. It is an essential part of a Java program.

24
Q

How is a class definition structured in a Java program?

A

A Java program may contain several class definitions. Classes are the main and essential elements of any Java program.

A Java program may contain several class definitions. Classes are the main and essential elements of any Java program.

25
Q

Java code is case sensitive

A

To write a Java program, you must have to define class first.

The name of the class in Java (which holds the main method) is the name of the Java program, and the same name will be given in the filename.

26
Q

public class Hello

A

This creates a class called Hello.

All class names must start with a capital letter.

27
Q

Two curly brackets

A

..are used to group all the commands, so it is known that the commands belong to that class or method. We call it code block.

This is a C-Style comment or a multiline comment.

28
Q

/This is a comment./

A

The compiler ignores the comment block. Comment can be used anywhere in the program to add info about the program or code block, which will be helpful for developers to understand the existing code in the future easily.

29
Q

public static void

A

When the main method is declared public, it means that it can also be used by code outside of its class, due to which the main method is declared public.

The word static is used when we want to access a method without creating its object, as we call the main method, before creating any class objects. The word void indicates that a method does not return a value. main() is declared as void because it does not return a value.

30
Q

main()

A

main is a method; this is a starting point of a Java program.

You will notice that the main method code has been moved to some spaces left. It is called indentation which is used to make a program easier to read and understand.

31
Q

This is a comment “//”

A

• This is another comment and does not affect the flow of the program.
• C++ Style comments start with // and all the text after // are treated as comments.

32
Q

It is an array where each element of it is a string, which has been named as “args”. If
your Java program is run through the console, you can pass the input parameter, and
main() method takes it as input.

A

String[] args

33
Q

“Java keywords” are also known as “reserved words”. Keywords
are particular words that act as a key to a code. These are
predefined words by Java so they cannot be used as a variable
or object name or class name.

A

List of Java Reserved Keywords:

break
default
abstract
char
else
assert
class
enum
boolean
continue
extends final finally
byte case catch
do double
float for
if
implements
import
instanceof
int
interface long
native
new null package
private
protected
public
return
short
strictfp
super
switch
synchronized
this
throw
throws transient try
void
volatile
while

34
Q

JAVA ESCAPE CHARACTERS

A character preceded by a backslash () is an escape sequence and has a special meaning to the compiler.

A

The following are the Java escape sequences:

\t - Inserts a tab in the text at this point.

\b - Inserts a backspace in the text at this point.

\n - Inserts a newline in the text at this point.

\r - Inserts a carriage return in the text at this point.

\f - Inserts a form feed in the text at this point.

' - Inserts a single quote character in the text at this point.

" - Inserts a double quote character in the text at this point.

\ - Inserts a backslash character in the text at this point.