Learning Objectives:
How software is developed;
The programming process;
The three step programming model;
Install Java and the Java Runtime Environment (JRE);
Install Eclipse, an integrated development environment (IDE);
Compile, run and debug a Java program;
Java program structure;
Usage of primitive data types;
Define and initialize variables;
Write expressions and arithmetic statements;
Promotion and casting;
Declare derived data types—Strings;
Use string operations (methods);
Be able to do keyboard input.

I’ve discovered that I enjoy two things:
First, I like learning in a step-by-step manner that gradually leads you into a new field. I don’t recommend rote memorization; instead, I prefer learning based on understanding the underlying logic and reinforcing it through assignments, quizzes, discussions, and other activities. This is something I’ve consistently felt throughout this course. As a result, I’m very open to the concept of algorithm.
Second, compared to writing essays, I much prefer writing code or creating graphics. It’s more intuitive and gives a greater sense of accomplishment, as I tend to complete these tasks more successfully.
Therefore, even though Java isn’t Python, I still find myself thoroughly enjoying the learning process, and I’m not at all worried about completing the assignments well and achieving good grades.
However, even at this early stage, I’ve already found some aspects that require significant mental effort, including:
First, fully understanding the concepts of files, classes, methods, and objects, as well as their relationships—especially objects.
For example:
import java.util.Scanner;
public static void main (String[] args);
Scanner scnr = new Scanner(System.in);
I know these lines of code are standard, but understanding the specific meaning of each part requires quite a bit of effort.
Second, the use of the division symbol / and especially the modulo operator %, such as when extracting a prefix from a phone number or generating a random number within a range.
Third, the JOptionPane class.
Fourth, determining how to set up different variables and establish their relationships when writing code.
Overall, though, it’s a very engaging learning process, and I don’t find it off-putting at all.
I just hope that as I dive deeper into the material, I won’t get discouraged.

Part of Personal Key Points:
Programming Language:
An algorithm is a set of well defined steps to completing a task.
The steps in an algorithm are performed sequentially.
A computer needs the algorithm to be written in machine language.
Machine language is written using binary numbers.
The binary numbering system (base 2) only has two digits (0 and 1).
The binary numbers are encoded as a machine language.
Each CPU has its own machine language.
Compiler and JVM:
Byte code files end with the .class file extension.
The JVM is a program that emulates a microprocessor.
The JVM executes instructions as they are read.
JVM is often called an interpreter.
Java is often referred to as an interpreted language.
Program Development Process:
Text Editor
|
| Saves Java statements
v
Source code (.java)
|
| Is read by
v
Java Compiler
|
| Produces
v
Byte Code (.class)
|
| Is interpreted by
v
Java Virtual Machine (JVM)
|
| Results in
v
Program Execution
Portability:
Java provides a JVM (Java Virtual Machine)for each platform,
so that programmers do not have to recompile for different platforms.
Java byte code runs on the JVM and not on any particular CPU; therefore, compiled Java programs are highly portable.
Additional Features of IDEs:
Debugger
Project management
Syntax aware
Code completion
Graphical representation
(Local) Variable Declaration and Initialisation
int x;
x = 6;
Variables must be declared before they can be used.
Local variables do not receive a default value and must be initialised before being compiled.
the assignment statement is composed of :
a variable name / the operand on the left + the assignment operator (“=”) + literal or expression based on the data type of the variable
all initialisations (the first time) are assignment statements; but not all assignment statements are initialisations.
Naming Conventions:
Class names should be all title case (BankAccount/Simple);
Variable names begin with a lowercase letter and then title case when a new word occurs ( userAge);
both are usually nouns or noun phrases.
Identifiers:
Identifiers are programmer-defined names for variables, methods, classes.
Case sensitive.
The first character may not be a digit. No spaces.
Can be letters, numbers, underscores, the dollar sign.
Can not use keywords.
Reserved Keywords:

Two ways to use +:
as a concatenation operator (strings)
as an addition operator(digits)
Often used in mixture. Be careful.
Variables and literals:
String name = “Bella”;
A variable is a named storage location in the computer’s memory.
A literal is a value that is written into the code of a program.
System.out.print/println();
This line uses the System class from the standard Java library.
The System class contains methods and objects that perform system level tasks.
The out object, a member of the System class, contains the methods print and println.

API:
Java classes in the standard Java library are accessed using the Java Applications Programming Interface (API). The standard Java library is commonly referred to as the Java API.

Standard output and input devices
Class and file:
A Java source code file contains one or more Java classes.
If more than one class is in a source code file, only one of them may be public.
The public class and the filename of the source code file must match.
ex: A class named
Simplemust be in a file namedSimple.java
Each Java class can be separated into parts.
swaps the current values of x and y
t = x;
x = y;
y = t;
留下评论