Java Summary of the first lesson
Overview
The Java language, a new programming language introduced by Sun in 1995, is a cross-platform, purely object-oriented language suitable for distributed computing environments.
Jvm:java virtual machine;
Api:java application Programming interface.
Get and install the Java Development toolset (JDK)
Web site: HTTP://WWW.ORACLE.COM/CN
¯ JDK6.0 Composition Structure
Bin:java Development Tools, Javac, Java, etc.
Demo: Demo program
include: C + + header file for calling local (underlying platform) methods
Jre:java Runtime Environment (JRE)
lib: Class Library and required supporting files
Configure environment variable path
The Μ environment variable (environment Variable) is a variable that is used at the operating system level to save information about the running environment.
Μ the environment variable path to record where the executable program is stored, so that it can be found and run directly on any path.
Μ Setting Method
Right-click My Computer properties and select Advanced environment variables in the System Properties dialog box that pops up.
U find the variable path in the System Variables list box, double-click the row to edit it (; C:\Program files\java\jdk1.6.0_10\bin)
----------------------------------------------------------------------------------------------------------- -----------
Introduction to DOS command:
CDs: For entering a folder or exiting a folder
For example: C:\>CD ABC//enter into the ABC directory of c disk.
C:\ABC>CD.. Exits the ABC directory. Cd\ straight back to the root directory.
Set : Used to set variables in Windows.
set path= path 1; Path 2
However, this kind of setting is temporary, only valid in the current DOS window.
want to be once and for all, my Computer--attribute--advanced--environment variable--path: On the original basis, add a new value.
----------------------------------------------------------------------------------------------------------- -----------
Hello World;
To define Java files, Java programs exist in the form of classes.
you can define a class by the form of the keyword class name.
and the scope is determined by {}.
If you want this class to run independently, you need to join the main function.
If you need a computer to interact with you. You can add an output statement.
Class Demo//Define a classes, class named Demo
{
Public static void Main (string[] args)//main function
{
System.out.println ("Hello World"); /* Output statement, the content in parentheses is the content of the output.
}
}
features of the main function:
1, to ensure the independent operation of the program.
2, the program entrance.
3, invoked by the JVM.
after the program is finished,
steps:
1, open the DOS command line.
2, enter the directory where the Java files reside.
3, the Java file is compiled (translated) using the Javac command.
a class name. class file was generated. The file that the file computer recognizes.
Note: There is an error indicating that you need to change the source code according to the location of the error.
4, the bytecode file is executed through the Java command. Java class name
the rules Μ need to master
The Java language is case sensitive (case-sensitive), such as HelloWorld and HelloWorld are two completely different class names, String≠string,system≠system.
You can define multiple Java classes in a source file, but only one class is defined as a public class.
If the source file contains a public class, the source file must have the same name as the public class (with the. java extension).
• When multiple Java classes are included in a source file, multiple bytecode files are generated after compilation, that is, each class generates a separate ". Class" file with the same file name as the class name.
--------------------------------------------------------------------------------------------------------------- -------