package com.practice.doit.chapter1;
public class Demonstrate {
public static void main(String[] args) {
System.out.println("The rating of the movie is: ");
System.out.println(6+9+8);
}
}
46. Said with more precision, print and println are display methods that are defined to work on instances of the PrintStream class. System.out is an expression that produces the particular instance of the PrintStream class associated with your display.
precision[prisíʒən] 정확, 적확; (기계적인) 정밀 the quality, condition, or fact of being exact and accurate
47. A value that appears explicitly in a program is said to be a literal. Explicit numbers, such as a 6, are integer literals. Explicit strings, such as "The rating of the movie is", are string literal.
explicitly [iksplísitli] 솔직하게, 명시적으로 in a clear and detailed manner, leaving no room for confusion or doubt
49. Java is case sensetive; if you write Main or MAIN when you mean main, Java cannot understand your intent.
51. To initiate complilation on a Windows system, you open a window. Next, type the following, assuming that your class definition is in a source file named Demonstrate.java:
javac(it's a name of the Java compiler) Demonstrate.java (Source file's name and extension)
👉 I used Visual Studio Code to compile java source code and run class file.
The Java compiler places the resulting byte code in a file named Demonstrate.class.
52. Once the Java compiler has placed the resulting byte code in Demonstrate.class, you can execute the main program defined inside the class definition by typing another command line:
java (Name of the JVM) Demonstrate(Object file's name)
53. Although the sample program communicates with you by way of ouput data displayed on your screen, it does not receive any input data after it has been compiled. Instead, it works with data that were supplied as the program was written. Such data are said to be wired or hard coded.
💡 Did the word "Autowired" at Spring annotation come from that wired?!
Highlights
- When you work with Java, you write source code, the Java compiler translates source code into byte code, and the JVM executes that byte code.
- Java programs consist of class definitions. If a program is to be a standalone program, one of the class definitions must contain a definition for a method named main. When you execute a standalone Java program, the JVM performs the computations specified in that main method.
- Java methods contain computation-specifying embedded in statement sequences.
- Many expressions involve built-in operators, such as the addition operator, +. Operators do their work on operands.
- If you want to display data, then use a display statement:
System.out.print(expression whose valuse is to be displayed); - If you want not only to display data, but also to terminate a line, then use println instead of print.