Overview of the Java language and computer

1. Overview of the computer

A computer (Computer) commonly known as a computer, a computer unit for calculating a high-speed modern, numerical calculations may be performed, but also can be logically calculated, further having a memory function.
Hardware and software systems composed of, without any software installed called bare computer.

2. Composition of the computer

① central processing unit (CPU
abbreviated CPU usually consists of two parts: the control unit and arithmetic / logic unit is measured in units of hertz CPU speed.

② memory
computer memory by one byte of the ordered sequence of, for storing programs and data required for the program.
Each byte has a unique address, using that address to determine the location of the byte, in order to acquire data and to store. Since the bytes can be accessed in any order, so the memory is also called a random access memory (RAM).
RAM is a volatile form of data storage.
Hard disk for permanent storage of data and programs.


③ storage device (magnetic disk and an optical disk)
for long-term storage of programs and data.
Storage equipment consists of four types: disk drives, optical disk drives, tape drives, USB flash drives.


④ input devices (keyboard and mouse)
1. keyboard, function keys, modifier keys, a numeric keypad, arrow keys, insert key, delete key, page-up key and down key.
2. mouse
3. monitor, screen resolution and dot pitch determine the quality of the display.

⑤ output devices (monitor and printer)
display, a screen resolution, and determines quality of the display dot pitch.

⑥ communication device (NIC)
dial-up modem, DSL, cable modem, network interface card, and wireless communication devices.

These components are connected via a bus called a subsystem.

3. Operating Systems

Computer operating system is to manage hardware and software resources of a computer program, but also the core and the cornerstone of the computer system. The operating system need to be addressed as priorities memory management and configuration, the system determines supply and demand of resources, the control input device and an output device, the basic operation of the network and management of the transaction file system. Operating system also provides a user interface to let users interact with the system

Popular operating systems are Microsoft Windows, Mac OS and Linux.

The main task of the operating system are:
① activity control and monitoring system
② distribution and deployment of system resources
③ scheduling operations

4.Java language

①Java Java language specification defines the syntax, Java libraries are defined in the Java API.
②JDK software is used to develop and run Java programs.
③IDE rapid development process integrated development environment.

A simple Java program

public class Hello World {
    public static void main(String[] args) {
        System.out.println("Hello World");
   }
}

note:

A left parenthesis must match a closing parenthesis. Whenever you enter a left parenthesis, elm should immediately into a right parenthesis to prevent false leak sent brackets appear. Most Java IDE will automatically insert a closing parenthesis for each left parenthesis.

Lu Java program is case-sensitive. If in the main program Main is replaced, an error occurs .

When the command line program, do not use extension .class. Use java ClassName to run the program. If you use a java ClassName.class, the system will attempt to read the command line ClassName.class.class

5. supplement

1 is a computer data storage and processing of the electronic device.
2. The computer comprises two portions Jun and software.
3. Hardware is part of a physical touch to the computer.
4. The computer program, which is commonly referred to as software, some invisible instructions that control the hardware to complete the task.
5. Design is to write computer programs to make computer executed instructions (ie, the code).
6. The central processing unit (CPU) is the brain of the computer. It fetches instructions from memory and executes the instructions.
7. The computer 0 or 1, because the digital device has two stable state, and the customary 0 1 refers.
8.- bit binary number is 0 or 1 refers.
9. a byte refers to 8-bit sequence.
10. Shu kilobytes is about 000 bytes, Katherine-section is about 100 million bytes, gigabytes Shu is about 000 million bytes, trillion-yu festival is about 1 trillion Yu Festival.
11. The data and program instructions stored in memory to be executed by CPU.
12. The memory cell section is an ordered sequence of buildings.
13. The memory is not long-term preservation of data, because the information will be lost when power is off.
14. The programs and data permanently stored in the storage device, the computer does need to use when they are transferred into memory.
15. The machine language is embedded in the original set of each computer instruction set. 16. Assembly language is a low-level programming language, which uses a mnemonic instructions for each machine language.
17. The high-level language similar to English is easy to learn and write programs.
18. The program is called a high-level language source code.
19. The compiler is the source quill into machine language program software.
20. The operating system (OS) is to manage and control computer activities program. 21.Java is platform-independent, which means just write a program that can run on any computer.
22.Java program can be embedded in HTML pages, downloading a Web browser. Web customers to bring vivid animation and flexible interaction. 23.Java source file name and the program must be in the same class name public, and ending with the extension .java.
24. Each class is compiled to a bytecode buildings separate file with the same name as the class name, extension of .class.
25. Use javac command from the command line to compile Java source code files.
26. Use the java command from the command line can run Java classes.
27. Each set of procedures are defined in a Java class. Human primer keyword class definition, the class contained in the content block.
28. {a start block, the left to right brace brace () (}) ends.
29. A method comprising in the class. Each Java program executable must have a main method. The main method is the population program begins execution.
30.Java Each statement is a semicolon (;) end, also referred to as the statement terminator symbol.
31. Reserved words or word Kin Guan said, to the compiler has a special meaning in the program can not be used for other purposes.
32. In Java, on a single line guiding two slashes (//) comment, called line comments; one or more rows with / * and V contains comments, comment referred to as block or segment comments. The compiler will ignore the comment.
33.Java source is case-sensitive.
34. Programming errors can be divided into three categories: syntax errors, runtime errors and logic errors. Error reported by the compiler called syntax errors or compilation errors. Run-time error refers to an error caused by abnormal end of program. When a program is not performing as expected, an error generation logic.

6. examples

Demo1. Write a program that displays the results of the following formula.
(9.5 4.5-2.5 3) / (45.5-3.5)

public class demo1 {
    public static void main(String[] args)主函数 {   //主函数
    System.out.println((9.5*4.5-2.5*3)/(45.5-3.5)); //输出语句
  }

}

Demo2. Suppose a runner 1 hour 40 minutes 35 seconds 24 miles run. Write a program to display how many kilometers per hour as the average speed values ​​(note, one mile equal to 1.6 km.)

public class Demo2{
    public static void main(String[] args){
        double V;
        V=(1.6*24)/(1+40/60+35/3600);
        System.out.println("The runner speed is" + V + "km/h" );
         }
}

 

Released six original articles · won praise 0 · Views 132

Guess you like

Origin blog.csdn.net/q1220668269/article/details/104185595