java Flashcards

1
Q

java environment

A

is the entire ecosystem where java applications are developed ,managed and executed

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

components and concepts of java environment

A

java development kit
java runtime environment
java virtual machine
java compiler
cross path
java standard libraries
integrated development environment

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

java development kit

A

it is a package that has everything needed to develop, manage and run java applications

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

java runtime environment

A

it has the needed libraries for executing java applications

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

java virtual machine

A

it interprets and executes java bytecodes

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

Java Compiler

A

it compiles java source code to bytecode

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

Java Standard Library

A

it provide ready-made functionality for tasks

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

Class path

A

it tells the JVM where to find classes and libraries required by a Java application.

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

Integrated Development Environments

A

provide a convenient development environment for Java programmer

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

Case Sensitivity

A

meaning that it distinguishes between uppercase and lowercase letters

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

Operators

A

various operators, including arithmetic (+, -, *, /), comparison (==, ===, !=, !==, >, <), logical (&&, ||, !), and assignment (=).

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

class names

A

Java class names must start with an uppercase letter and follow the CamelCase convention (e.g., MyClass).

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

. Method Names

A

Method names in Java start with a lowercase letter and also follow CamelCase (e.g., myMethod).

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

.Variables

A

Java requires explicit data type declarations for variables, e.g., int myVariable = 10; specifies that myVariable is an integer

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

public static void main

A

Java programs start executing from a public static void main(String[] args) method within a class. This method serves as the entry point for the program

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

Program File Name

A

the file name must match the public class name defined in that file, including capitalization (e.g., MyClass.java for class MyClass).

12
Q

. Identifiers

A

must start with a letter, underscore (_), or dollar sign ($) and can be followed by letters, digits, underscores, and dollar signs.

13
Q

.Arrays

A

Java arrays are strongly typed, meaning they can hold only elements of a specific data type. For example, you declare an integer array as int[] myArray.

13
Q

Enums

A

Java supports enumerated types (enums), which define a fixed set of constants or values

14
Q

Java data types

A

integer-whole numbers
float-decimals
string-text
boolean-true or false

15
Q

Java statements

A

statements are individual instructions that make up a Java program

16
Q

Declaration Statements

A

Declaration statements are used to declare variables. They specify the name and data type of a variable.
int age; // Declaration statement for an integer variable named “age”

17
Q

Assignment Statements

A

Assignment statements are used to assign values to variables.
age = 25; // Assignment statement: assigning the value 25 to the “age” variable
```

18
Q

Expression Statements

A
  • Expression statements consist of expressions that are evaluated and may produce a result. They are often used for their side effects.int result = 5 + 7; // Expression statement: calculating the sum of 5 and 7 and assigning it to “result
19
Q

Conditional Statements

A

Conditional statements allow you to control the flow of your program based on conditions. Commonly used conditional statements include if, else if, and else.
if (age >= 18) {
System.out.println(“You are an adult.”);
} else {
System.out.println(“You are a minor.”);
}
```

20
Q

.Loop Statements

A

Loop statements are used for repetitive tasks. Java provides several loop types, including for, while, and do-while.
for (int i = 0; i < 5; i++) {
System.out.println(“Iteration “ + i);
}

21
Q

Switch Statement

A

The switch statement is used to select one of many code blocks to be executed.
int day = 2;
switch (day) {
case 1:
System.out.println(“Monday”);
break;

22
Q

Local Variables

A

Local variables are declared within a method, constructor, or block of code and have limited scope.
public void someMethod() {
int localVar = 10; // Declaration and initialization of a local variable
// localVar is only accessible within this method
}
```

23
Q

Class Variables (Static Variables)

A

Class variables, also known as static variables, belong to a class rather than an instance of the class.
- They are declared using the static keyword and are shared among all instances of the class
public class MyClass {
static int classVar = 5; // Declaration of a class variable
}
```

24
Q

Instance Variables (Non-Static Variables)

A

Instance variables are associated with an instance of a class and are not shared among different instances.
- They are declared within a class but outside of any method or constructor.
- Each instance of the class has its own set of instance variables
public class MyClass {
int instanceVar = 10; // Declaration of an instance variable

25
Q

Integer Constants

A

Integer constants represent whole numbers and can be of various numeric types (e.g., int, long, short, byte).
- Example:
int integerConstant = 42

26
Q

Real Constants (Floating-Point Constants)

A
  • Real constants represent numbers with a fractional part and can be of types like float or double.
27
Q

. Strings

A

Example:

 String text = "Hello, World!";
27
Q

Variable Reading

A

Variable reading refers to retrieving the value stored in a variable. You can read the value of a variable by simply referencing its name in expressions, conditions, or method arguments

28
Q

Variable Arithmetic

A

Java supports various arithmetic operations on numeric variables (e.g., int, double, float) for performing calculations. Common arithmetic operators include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).

29
Q

Object Instantiation

A

In Java, objects are instances of classes, and you can create objects using a process called instantiation. To instantiate an object, you use the new keyword followed by the class constructor