Java Learning Log Day 01|2025/2/11|1 day in total
⏰ Today's study time 6 hours
Learning goals for the day
1. Understand JVM, JDK, JRE
2. Learn the basic use of Idea development tools
3. Basic syntax: operators, data types, variables, constants, control flows, methods
Core learning content
- JVM:
JVM
It is the abbreviation of Java Virtual Machine and is a virtual machine necessary to run Java programs. JDK is the implementation of JVM, and JRE is the running environment of JVM - Operators: arithmetic, relationship, logic, bit operations, assignment
- Overload: Only care about the same method name and different parameter list
- Data type: basic data type, wrapper class, string, array, reference data type
- Variables: local variables, member variables, static variables
- constant:
final
Modified variables - Control flow: if, switch, while, do while, for, break, continue, return
Learning results verification
package ;
import ;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner();
guess();
// Determine whether a number is a prime number
int n = ();
(isPrime(n) ? "Prime" : "Not Prime");
}
/**
* Number guessing game
*/
public static void guess() {
Scanner sc = new Scanner();
int luckyNum = (int)(() * 100) + 1;
while(true) {
int guessNum = ();
if(guessNum == luckyNum) {
("You guessed it!");
break;
}else if(guessNum > luckyNum) {
("You guessed too high!");
}else {
("You guessed too low!");
}
}
}
/**
* Determine whether a number is a prime number
* @param n
* @return
*/
public static boolean isPrime(int n) {
if(n < 2) return false;
if(n == 2) return true;
for(int i = 2; i < (n); i++) {
if(n % i == 0) return false;
}
return true;
}
}
Reflection and questioning
I have had a certain basic C and C++ before and I learned very quickly, but I am still not very proficient in Java syntax and need to practice more.
Tomorrow's plan
1. Learn the use of arrays in Java
2. Master the basic concepts of object-oriented OOP: class, object, encapsulation, inheritance, polymorphism, etc.
💬 Interactive invitation
Looking forward to friends leaving messages to communicate →/tegou
Your collection/likes are my motivation to keep updating🔥
See you on Day 02!