Java Basics Flashcards
Learn some basic Java info like what year/who created Java
Who owns Java?
Oracle
What two programming languages are most similar to Java?
C++ and C#
What type of programming language is Java?
Ex. Logic programming, scripting programming
An object-oriented language
Is Java a proprietary, closed source, open source, or free software?
Open source
What year was Java created?
1995
Every line of code that runs in Java must be inside a ___?
class
Should a class always start with an upper case or lower case letter?
Upper case
Would Java read these as being the same? “MyClass” and “myclass”
No, Java is case sensitive
What’s a statement in Java?
A statement is a complete instruction terminated by a semicolon.
Ex.
“x = 5 + 5;” is a statement
What’s an expression in Java?
An expression is a combination of operators, literals, method calls, constants, and variables. It does not include data types or semicolons. Expressions are part of statements.
Ex.
Double “x = 5 +5”;
System.out.println(““this is an expression””)
What can expressions can do?
Produce a value: int “x = 1+1”;
Assign a variable: int “v = 10” ;
Produce no result but might have a side effect. Side effects occur when an expression changes the value of any of its operands. Ex.
int “product = a * b” ;
The only variable changed in this expression is product, a and b are not changed. This is called a side effect
What are the three types of Java statements?
Expression statements
Declaration statements
Control-flow statements
What do declaration statements do?
They declare variables ex. x = 5;
What do control-flow statements do?
They determine the order that statements are executed
Can variables created in a code block be used outside of the code block?
No, variables created in a code black can only be used in the same code block