Java-based on-machine jobs

Source: Internet
Author: User

Third, the configuration of the JDK environment variable path and java_home use?

Java_home environment variable name Runtime program can automatically find where

Path to search when executing program

Iv. use a text editor to enter the that are practiced in the classroom and compile and runit in a JDK environment. Please compile the program, run the results

Create a new text document and modify the suffix to Java

Class Hello


public static void Main (String [] args)


System.out.println ("Hello World");



V. Enter in a DOS command:java Hello has the following result:What might be the reason for bad command or the file name?

(Bad command or file name) The command entered does not exist or is not in the specified path

Vi. in DOS command under Enter: Java Hello appears with the following result:Exception in thread "main" Java.lang.NoClassDefFoundError:Hello what could be the reason? 1. The class name should have the same name as the Java file

1. The class name should have the same name as the Java file
2. If window automatically hides the file suffix name, do not hide the suffix name, change the file suffix to. Java
3. Whether to import the package name you need
4.JAVA environment variables are set correctly

Seven, Hello.class where the path, input command:java hello.class, what will happen, why?

Viii. the difference between a basic data type and a reference type:

1, Memory use: The basic type of value is stored directly in the stack memory; the value of the reference type is stored in the heap memory, the first address in the stack memory

2, Variable assignment: The basic type is to copy the assignment to the new variable; The reference type is the copy of the first address to the new variable

Nine, What kinds of file types do java have? What are the respective roles?

Source code:. java

Bytecode:. class produced after the source code has been compiled

Jar package:. Jar compresses related bytecode files for ease of use and delivery

Write a Java program that calculates The circumference length and area of the radius of 3.0 and outputs the result. The pi is defined as a constant, the radius is defined as a variable, then calculated and the result is output.

 Public classYuan { Public Static voidMain (string[] args) {//TODO Auto-generated method stubs        intA=3; FinalDoubleC=3.1415926; Doubleb=2*a*C; Doublee=a*a*C; System. out. println (b); System. out. println (e); }}

Xi. Write a Java project, define the package, define the class containing the main method under the package, declare 8 in the main method Types of basic data and assign values to practice data type conversions.

Java-based on-machine jobs

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.