• 淘宝、京东、拼多多购物助手上线,希望大家多多支持!

  • 增加付费可看,结合购物助手

  • 马上要过年了

  • 下载资源可以使用了! :mrgreen:

  • 今天天气一般般!

Internal Details of Hello Java Program

JAVA 空手师 4年前 (2019-11-15) 503次浏览 已收录 0个评论

Internal Details of Hello Java Program

  1. Internal Details of Hello Java

In the previous page, we have learnt about the first program, how to compile and run the first java program. Here, we are going to learn, what happens while compiling and running the java program. Moreover, we will see some question based on the first program.

What happens at compile time?

At compile time, java file is compiled by Java Compiler (It does not interact with OS) and converts the java code into bytecode.

compilation of simple java program


What happens at runtime?

At runtime, following steps are performed:

Java Runtime Processing

Classloader: is the subsystem of JVM that is used to load class files.
Bytecode Verifier: checks the code fragments for illegal code that can violate access right to objects.
Interpreter: read bytecode stream then execute the instructions.

Q) Can you save a java source file by other name than the class name?

Yes, if the class is not public. It is explained in the figure given below:
how to save simple java program by another name
To compile:javac Hard.java
To execute:java Simple

Q) Can you have multiple classes in a java source file?

Yes, like the figure given below illustrates:
how to contain multiple class in simple java program

空手之道 , 版权所有丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Internal Details of Hello Java Program丨部分内容为转载,如有侵权,请联系,删除处理!丨
喜欢 (0)

您必须 登录 才能发表评论!