Foundations Flashcards

1
Q

Java Keywords

A

In the Java programming language, a keyword is any one of 52 reserved words that have a predefined meaning in the language; because of this, programmers cannot use keywords as names for variables, methods, classes, or as any other identifier. For example “public” or “class”.

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

Access Modifier

A

As the name suggests access modifiers in Java helps to restrict the scope of a class, constructor, variable, method, or data member. There are four types of access modifiers available in java:

Default – No keyword required
Private
Protected
Public

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

Class

A

Everything in Java is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake.

A Class is like an object constructor or a “blueprint” for creating objects.

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

Method

A

A collection of statements (one or more) that perform an operation.

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

Main Method

A

The starting or entry point to every Java program:

public static void main(String[ ] args) {

}

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

Code Block

A

A Code Block is used to define a block of code. It’s mandatory to have one in a method declaration and it’s here where we add statements to perform certain tasks.
A code block occurs with and between the curly braces:

{

}

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

Statements

A

Java statements appear inside of methods and classes; they describe all activities of a Java program. Variable declarations and assignments, such as those in the previous section, are statements, as are the basic language structures like conditionals and loops.

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

Expressions

A

Expressions describe values; an expression is evaluated to produce a result, to be used as part of another expression or in a statement. Method calls, object allocations, and, of course, mathematical expressions are examples of expressions.

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

Variables

A

Variables are a way to store information in our computer. Variables that we define in a program can be accessed by the name we give them. The computer does the hard work of figuring out where they get stored in the computer’s Random Access Memory (RAM).

A variable, as the name suggests, can be changed, in other words, its contents are variable.

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

Declaration Statment

A

Used to define a variable by indicating the data type, and the name, and optionally to set the variable to a certain value.

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

Java Operators

A

Java Operators or operators perform an operation (hence the name) on a variable or value. Commong examples are:

\+ (Addition)
- (subtraction)
* (Multiplication)
/ (Division)
% (Remainder)
= (Assign value to)
== (Equivalence)
etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Java Packages

A

A package is a way to organize your Java projects. Think of them as folders.

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

Casting

A

Casting means to treat or convert a number from one data type to another. We put the type we want it to be in parenthesis like this (byte) (myMinByteValye/2);

Bonus: Other languages have casting, this is not just a Java thing.

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

String

A

A string, is used to store a series of characters. Although it is used like a primitive data type, it is not a primitive data type, it’s actually a class, but because we use it so often, Java gives favoritism to the String class and allows us to use it the same way we use primitive data types.

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