jnk1m
Foliage IT
jnk1m
전체 방문자
오늘
어제
  • 분류 전체보기 (209)
    • Today I Learned (34)
    • Java (47)
    • Database (15)
    • [NHN Academy] (27)
    • Spring (47)
    • HTML + CSS + JavaScript (11)
    • JSP (3)
    • Node.js (10)
    • React Native (2)
    • 기타 (8)
    • 스크랩 (5)

인기 글

최근 글

티스토리

hELLO · Designed By 정상우.
글쓰기 / 관리자
jnk1m

Foliage IT

Java

[On To Java 2] Chapter 2: How to compile and execute a simple program

2023. 1. 16. 14:47

 

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.
    'Java' 카테고리의 다른 글
    • Integer, StringBuilder 객체 생성 및 동등성 비교, append 메소드
    • [On To Java 2] Chapter 3: How to declare variables
    • [Database] User table, Post table relation & Cardinality
    • [연결 리스트]

    티스토리툴바