






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























inherit
super The extends keyword is used for class inheritance.
"102030"
"3030"
"30"
"3030" Java adds integers first (10 + 20 = 30), then concatenates the string "30", resulting in "3030".
private
public
protected
default The protected modifier allows access within the same package and subclasses, even if they are in different packages.
Int
integer
Number
ObjectClass
JavaObject
Object
Base The Object class is the root of the class hierarchy in Java.
static
final
const
fixed The final keyword makes a variable constant, meaning it cannot be reassigned.
static
unsigned
throw
synchronized Java does not support the unsigned keyword.
Call the main method
Call the parent class constructor or method
Define a new method
Override a class super is used to refer to the superclass's methods or constructors.
execute()
begin()
start()
init() To start a thread, you use the start() method, which invokes the run() method.
Compiled language only
Interpreted language only
Compiled and interpreted language
Scripted language Java source code is compiled into bytecode, which is interpreted/executed by the JVM.
Java Vendor Machine
Java Virtual Machine
Java Visual Model
Java Version Manager JVM stands for Java Virtual Machine, responsible for executing bytecode.
NullPointerException
ClassNotFoundException NullPointerException is a runtime (unchecked) exception.
true
1
false
null Boolean instance variables have a default value of false.
String
Math
Scanner
Object The Scanner class is in java.util, not java.lang.
Runnable
Runnable
Callable
Executable Runnable is the standard interface for creating threads.
&
&&
||
| Logical AND uses &&; bitwise AND uses &.
static
private
abstract
final An abstract method must be implemented by a subclass of the abstract class.
Current object
Parent class
Main method
Superclass constructor The this keyword refers to the current instance of the class.
for loop
while loop
Platform-independent
Object-oriented
Pointer support
Robust Java does not support pointers like C/C++.
try
catch
throw
return The catch block is used to handle exceptions thrown in a try block.
continue
break
return
exit The break statement is used to terminate a loop immediately.
"123"
123.
123
Error parseInt() converts a numeric string into an integer.
static
final
abstract
protected The final keyword prevents a method from being overridden.
Manual memory allocation
Automatic memory management
File deletion
Process killing Garbage collection automatically frees memory by deleting unused objects.
Code runs fine
Compiler error
Runtime error
Nothing The JVM cannot call a non-static method without creating an object.
Math.floor() returns the largest integer less than or equal to the input.
"abc"
"cba"
"abcba"
null The reverse method of StringBuilder reverses the string.
return
static
public
void The void keyword specifies that the method returns no value.
Can contain constructors
Can contain private methods only
Can contain default and static methods
Cannot be extended Since Java 8, interfaces can contain default and static methods.
ArrayList
Vector
LinkedList
HashMap Vector is synchronized; ArrayList is not.
"ell"
"hello"
"llo"
"hel" substring(1,4) gives characters from index 1 to 3 (excluding 4).
@Inherited
@Implemented
@Override
@Method The @Override annotation ensures that a method is overriding a superclass method.
Compile code
Convert types
Clean up before garbage collection
Infinity
ArithmeticException
NaN Division by zero for integers results in an ArithmeticException at runtime.
init()
run()
constructor
build() Constructors are special methods called at object instantiation.
List
Set
Map
Queue Map stores data in key-value pairs and allows fast retrieval based on keys.
true
false
0
Logical AND (&&) only returns true if both operands are true.
Inheritance
Interfaces
Method Overriding
All of the above Polymorphism in Java is implemented through method overriding, interfaces, and inheritance.
Mutable
Stored on stack
Immutable
Uses char[] internally Strings in Java are immutable, meaning their value cannot be changed after creation.
java.lang
java.util
java.io
java.net The java.lang package is automatically imported by the compiler.
HashSet
TreeSet
ArrayList
PriorityQueue ArrayList maintains insertion order and allows duplicates.
Compilation error
Program ignores it
Program terminates abnormally
JVM halts gracefully Uncaught exceptions cause the program to terminate unexpectedly.
JDBCException
JNDI
JDBC
SQLLink JDBC (Java Database Connectivity) provides methods for CRUD operations on databases.
sub
this
extends
parent The extends keyword is used to inherit a class.
5
10
0
Error The Math.max() function returns the greater of two values.
Data hiding
Faster execution
Multithreading
Serialization Encapsulation hides internal object details, exposing only necessary parts.
FileInputStream
FileWriter
DataOutputStream
ObjectOutputStream FileWriter is used to write characters to a file.