JAVA Programming

¡Supera tus tareas y exámenes ahora con Quizwiz!

Object-Oriented

Java is object-oriented, thus each program is built from objects and classes.

Networking

Java works on internet and intranet applications alike.

Performance

Properly written Java programs execute quickly and use little memory.

access modifiers

Public Private Protected These access modifiers are used with classes, methods, and variables.

conditional operators

[Condition]? [true statement] : [false statement];

float

a 4-byte value that represents values from 1.40129846432481707 x 10-45 to 3.4028234

boolean

a one-bit value (one digit) represented true or false, 1 or 0

While

a period of time marked by a condition, i.e. Stay here while I go see the doctor.

simple if condition

if (Condition) { //true block }

if else statement

if (Condition) { //return true } else { //return false }

Polymorphism

the same class name can have many different functions

Switch

to shift from one to the other, i.e. Please switch places with me.

assignment operator

As its name, an assignment operator assigns a value to a variable. An assignment operator is represented by an equal sign. (X=5) With an assignment operator, Java runs the program from the right side to the left side. All other operators are evaluated from left to right.

Robust

Before executing a program, JVM conducts an overall checking of the program and gives reports of any malfunction.Thus, JVM is a robust programming language.

relational operators

Greater Than > Less Than < Greater Than or Equal To >= Less Than or Equal To <= Equal To == Not Equal To !=

iteration statements

Iteration statements repeat a function until a certain value or condition is satisfied. For Statement While Statement Do-While Statement

Platform Independence

Java's power comes from the ability to compile code that can be read on any computer that has the Java Virtual Machine installed.

Memory Management

Memory management is automatically handled by Java Virtual Machine, which means the programmer does not need to write code to manage memory.

public access modifiers

Public access modifiers give complete visibility of a variable or a method across all classes. In simple words you can tell that data will be available everywhere in the Java application. While programming, you need to specify this access modifier in the program. Public access modifier will be declared using the keyword public before a method or a class. Syntax for Method: [Access_Modifier] [Returntype] [Method_Name](args0, args1...argsn) { ................... } Syntax for Variable: [Access_Modifier] [datatype] [variable] = [value];

switch statement

in Java you use Switch statements to control the flow of the program. Switch statements access a particular case when needed. Switch statement works with most of the data types such as byte, short, char, and int. switch (expression) { case cond1: code_block_1 ; break; case cond2: code_block_2; break; ... case condn: code_block_n; break; default: code_block_default; break; }

identifier

must start with a letter. It can be followed by a combination of numbers and two allowed special characters: underscore '_' and dollar sign '$'. When naming identifiers you need to be careful not to use any Java keywords.

selection statements

return true or false values. This means that until the condition is satisfied, the program will return true or false

Inheritance

transferring the properties of one class to another

! operator

! represents the logical operation NOT. In this type of operator the result is the opposite of the first operand. X Y X! 1 1 0 1 0 0 0 1 1 0 0 1 Note: 1 represents true, 0 represents false In this operation, if X is true then the resulting value will be false. This logical operator is used primarily to construct multiple conditional statements.

conditional statements

...

data types

...

operators

...

Comment Opener

/*** [line for comment] ***/

multi line comment

/**....**/

single line comment

//......

compound operators

A Compound operator is a combination of arithmetical and assignment operators. + = Increments the value of the variable - = Decrements the value of the variable

variables

A placeholder—it's the value of which can be modified according to the needs of the program or the results of a calculation.

Do-While Statement

Do-while statements are different from the other iteration statements. Instead of checking the condition, they will first perform the operation and then and then check for the condition. initialization; do { Statement; increment/Decrement; }While(Condition);

logical operators

These operators are used to evaluate two expressions. The evaluation stops as soon as the result is known. && AND || OR ! NOT

If

in the event that, i.e. If this occurs, that might happen.

Static

not moving, i.e. The static content on the screen did not move.

Encapsulation

wrapping data in a single unit

protected access modifiers

A protected access modifier has the similar features to that of private access modifiers, except the method or variable in the class can be inherited. Syntax for Method: [Access_Modifier] [Returntype] [Method_Name](args0, args1...argsn) { ................... } Syntax for Variable: [Access_Modifier] [datatype] [variable] = [value];

arithmetic operators

Addition + Subtraction - Multiplication * Division / Modulo Division %

bitwise operators

Anything and everything in the computer's memory is stored as a bit represented by 1s and 0s. So, the machine language of a computer is 1 and 0. It's that simple. Programmers use bitwise operators to manipulate these bits. & Exclusive AND ^ Exclusive OR | Inclusive OR

Compiler/Interpreter

The Java compiler translates the original code into bytecode so that any computer with JVM installed can run the compiled code, regardless of platform or operating system.

While Statement

The While loop evaluates the condition first, and the execution starts only if the condition is found to be true. initialization; while (Condition) { Statement; increment/Decrement; }

&& operator

This logical operator represents the logical operation AND in Java. This expression shows the result true if both its operands have the same value and false if not. X Y X&&Y 1 1 1 1 0 0 0 1 0 0 0 0 Note: 1 represents true, 0 represents false

|| operator

This operator represents the logical operation OR in Java. This expression shows the result false only if both its operands have the same value, and true even if one value is satisfied. X Y X||Y 1 1 1 1 0 1 0 1 1 0 0 0 Note: 1 represents true, 0 represents false

Javadoc

To avoid mistakes and problems later as the program becomes longer and complex, you need to include comment statements in your program to identify the program or section of code's purpose/this documentation of comments

Private Access Modifiers

When a method or a variable is declared private, they are not accessible outside their class (by default all methods are private). A private class or method cannot be inherited and it cannot be used in an interface. To take full advantage of the object-oriented programming pillar of encapsulation, you should limit access as much as possible within the program. Syntax For method: [Access_Modifier] [Returntype] [Method_Name](args0, args1...argsn) { ................... } Syntax for variable: [Access_Modifier] [datatype] [variable] = [value];

For Statement

When you want to control the number of times the condition has to be done, you want to create a loop. You use a for statement to create a loop. The for statement consists of the keyword for, followed by the three expressions in parenthesis separated by semicolons. These expressions are the initialization expression, test expression and the increment/decrement (re-initialization) expression. for (initialization; condition; increment/decrement) { //statement }

Class

a blueprint which describes methods, functions, and constructors

Return

a statement which gives the output of the specific task. This will be used when you implement the conditional statement.

Public

accessible or shared by all members, i.e. I went into the public restroom.

Then

at that time, i.e. I walked into the office and then went to sit down.

object

capable of receiving messages, processing information or data, and sending messages to another/a class created at runtime

Data Abstraction

hiding data; Hiding the irrelevant features and exposing only the needed features of a particular object

Else

otherwise, i.e. You must do this or else go to bed.


Conjuntos de estudio relacionados

Chapter 8: Weathering, Soil, and Mass Movement

View Set

Chapter 31: The Child with Musculoskeletal or Articular Dysfunction

View Set

French Revolution Causes Quizlet

View Set

Unit 10 - Musculoskeletal + Derm

View Set

Real Estate Practice, Edition 9, Chapter 3 Quiz

View Set

Final Exam for Fall semester of Surgical technology

View Set

chapter 13 ITN 261 Web servers and Applications

View Set

Sports Medicine Midterm Study Guide -- Chapter 1

View Set