Fundamentals of Java Foundation Course 2--I/O operations

Source: Internet
Author: User

Fundamentals of Java Foundation Course 2--I/O operations

Today we will look at some basic concepts of object-oriented programming, what is a class, what is a function

and understand the four functions of forming a program, responsible for processing data input, output IO, the control of the calculation process of the logical control, responsible for the calculation of the data calculations, the operation of the temporary variables generated in the storage cache, and how they support each other and work together.

What is software?

First, we learn programming, but we have to figure out what software is.

Software, English name software first proposed by Alan Turing, in the field of software engineering, computer science, software is through the computer, automated processing operation instructions, data calculation process.

Therefore, learning it, especially the software programming technology, need to establish such a fuzzy concept, in our computer (Science/engineering) field, so-called computing is a process, is a process that contains data processing, and control of the operation of automation processes. Therefore, we can say that any implementation of the data processing, the operation of the command automation control process can be regarded as software.

So to give a simple example, even if there is no systematic training of ordinary people, daily life, work is the most commonly used in Excel. We rely on Excel to write simple cash flow tables, statistical resources and inventory tables for cargo storage, all of which are the simplest software. What is slightly more complicated is that in some companies ' early business, Excel is used for regression analysis, discrete analysis, and linear analysis to support the company's production, market, and financial decisions. This is the process of using the functions provided by Excel, processing the data, and automating the control of the operation, which is the software.

(where the yellow part is the formula we created, which is the function we create to automate the statistics of the total price.) )

Any software that we split, categorized by function type, can be found to contain four categories of content such as access to external data, read/write (I/O), control of the running process, processing of data, and storage of temporary data generated during processing.

Starting with I/O First, we learn that software programming starts with the console (cmd/terminal), and we learn how to read data from the console and output data. But it needs to be clear that the operation of the console is only the basis of the foundation, in you master the external file read and write, communication between the processes, communication between the devices you can operate, control the vast majority of equipment, and these problems are gradually upward.

Then the other is the most basic, is repeatedly abstracted and proved that the three logical control structures are actually available, any program control process can be decomposed into the most basic three basic logic control structure, they are sequential execution, loop execution, condition execution.

How to deal with the data and processing, for software programming is a learning that deserves in-depth study. The simplest process is to add, subtract, multiply, and divide the values. In this field, the processing of data, the pursuit of the best and fastest, resulting in data structures, algorithms, these engineering technical methods, and the data processing, hoping to dig out more effective content of the technology, the evolution of neural networks, data mining, deep learning these technologies. The former is biased toward engineering, while the latter is academic.

Our CPU is processing the data, the resulting data is not all in the CPU, so this data will be written into RAM, it is a temporary data storage unit, like everyone's work desk, put your most commonly used equipment, data, etc., you need to use when you can pick up at any time, Instead of running to a far-away warehouse, slowly rummaging through the data.

Basic concepts of Java Ood programming

In dealing with complex things, one of the basic tools used is abstraction. The purpose of abstraction is to distinguish between the essence and the difference between things, and the essence of object-oriented programming (OOP) is to use classes and objects to create abstract models.

class represents the category of an object and is the blueprint for creating an object. The creation of an abstract model of a thing is essentially an expression of the nature and behavior of the thing. The use of classes to create abstract models is achieved by defining variables and methods in the class.

A property defined in a class is a variable that can store a value that represents the specific nature of the thing. The objects of a class have rows that are implemented by defined methods. The variables and methods defined in the class are called members of the class.

Classes Class

A class is a reflection of an entity in the real world or the mind world in a computer that encapsulates data and the operations on that data. For example, Zhang San has a brain with his eyes, he can sing, dance, and work.

Zhang San's eyes, brains, and hands are variables of the Zhang San class, and he can sing, dance, and work Zhang San functions (methods, or functions) of this class.

//Import the package name, which is the feature we want to enableImportJava.io.IOException; Public   class name {    //Encapsulated base variable     Public StaticString ...;protected Static int...;//Encapsulated function (operation)     Public Static void func1() {        ...    }Private Static void Func2() {        ...    } Public Static void Main() {        ...    }}

In the sample code snippet, class is decorated with classes, which are all operations related to the class, data storage, and control encapsulation. So you can understand that a class is an object that contains variables related to the object, as well as related operations.

What is an object? Object

You want to fall in love, the boy/girl is your object, you want to drink water, the cup is your object, you want to eat, Sheng Fan bowl is your object. In Java's Ood (object oriented design) approach, the so-called object is actually a very abstract concept, which is a concept that instantiates a class in particular.

Simply put, the glass is a class that contains the properties of the glass and the function of water, but if you want to drink, you need a specific object, the cup you drink, and the cup is your object.

In addition, from the English word meaning to explain, object also has a target object meaning, if you are male, then you chase Girl is a pseudo proposition, only you go Chase Han Meimeichai is a true proposition.

All right, let's get this out of here today, and set up another homework question:

Modify the following code so that it can correctly read the line of text you entered and exit the program correctly after the control line prints out the text.

ImportJava.io.IOException; Public  class HelloWorld {    //Input Output     Public Static void RP() {Try{//ASCII 0-255             while(true) {Charc = (Char) System.in.read ();            System.out.print (c); }        }Catch(IOException e) {System.out.println ("IO exception!"); }    }//Main     Public Static void Main(String args[]) {System.out.println ("My demo 2!");    RP (); }}

On

Under

Basics of Java Foundation Course 2--i/o

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: info-contact@alibabacloud.com 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.