Java basics

0.0(0)
studied byStudied by 0 people
0.0(0)
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:57 AM on 2/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

13 Terms

1
New cards

JDK components

Java development kit - javac - compiler, java - runs bytecode on JVM, javadoc - generates documentation, jar - packages Java applications.

2
New cards

method signiture

A method signature consists of the method's name and its parameter list(only the parameter types count, not the parameter names), which defines how the method can be called.

3
New cards

classpath

Tells the JVM where to look for classes and packages. The paths are on the local machine.

4
New cards

Instance initializer

Code block without method name, runs before constructor.

5
New cards

Object vs reference

Object - the actual values stored in the heap, can be accessed only through the reference. Reference - the variable that can be used to access the object - stores the address of the object

6
New cards

inboxing vs unboxing

inboxing: primitive → object, can parse string; unboxing: obj → primitive; e. g. Double obj = Double.valueOf(“2”); double primitive = obj.doubleValue(); // now java can make the cast implicitly: autoboxing, autounboxing

7
New cards

What kind of variables are initialized automatically?

Instance and class variables are initialized by default value.

8
New cards

Numeric promotion rule

When we use binary arithmetic operators(+,-, *, /, %) → smaller data types will be promoted to lager data types (short→ int)

9
New cards

Switch case classic syntax vs new syntax

switch(value) {

case v1:

//code

break;

default:

//code

}

String dayName = switch (day) {

case 1 -> "Monday"; // simple expression

case 2 -> { // block with multiple statements

System.out.println("It's Tuesday!");

yield "Tuesday"; // yield returns the value for this case

}

case 3 -> "Wednesday";

default -> "Other day";

};

10
New cards

for each enhanced loop syntax

for (ElementType element : collection) {

// use element, but cannot modify collection, element is a copy;

}

11
New cards

varargs

variable arguments; notation: arg…; It must be only one vararg parameter, and it must be the last parameter in the param. list. - the function can be called with empty paranthesis or with null: func(), func(null);

12
New cards

Maven project structure, what happens after compilation, how to reach a resource?

the compiled java files go to target/build, with the package structure(after the java package);

the resource folders contents go directly into target/build

reach resource(from compiled code): var stream = CurrentClass.class.getClassLoader().getResourceAsStream(‘filename‘);

classloader always looks for absolute path from the target/build

CurrentClass.class.getResourceAsStream(‘/filename‘); - i need to add the ‘/’ to look from target/build, or else it will search inside the package the class is

13
New cards

What is classloader?

  • locates classes/resources

  • gives back stream to process resource

  • loads class by reading it and creating a class object in memory.

  • the class object contains data about the class structure itself

  • Class <MyClass> clazz = Myclass.class; → reflection