String, Object and the subroutine (JAVA IV)

The previous section introduced the 8 types of primitive data types and data type String. The fundamental difference between primitive types and String is: the value of the String type of object. The object will be discussed in another section of the class (class). In this section we will learn how the String is used and also learn another important programming concept, namely subroutines.




Subroutine is a set of instructions that are combined so that the program has a specific function. In the Java language, each subroutine included in the section of a class or object. Java provides standard classes that are ready to use. Value of type String is an object that has a collection of subroutines that can be used to manipulate Strings tersetbut. We can call a subroutine without having to understand how the subroutine works. Actually this is the purpose subroutines, namely a set of commands that have specific functions without having to know in detail what is going on inside.

The class consists of variables and subroutines that are stored in it. Variables and subroutines are called static member (static member). An example is the program SelamatDatang, SelamatDatang class has members of main () which is a static member class. Members are given a supplement in the form of static member static, as in the main ().

The function of another class is to describe an object. Class here works like a data type. The value stored in data type that is the object. For example the class String is actually a name that is provided by the Java language. String data type and also in the form of sentences like "Welcome!" is the content of the data type String.

Usefulness both as a combined class of subroutines or as objects are often confusing. For example, the String class also stores some static subroutines as well as the type of data. Examples of other standards is a Math class that contains a collection of static subroutines to perform various mathematical calculations.
0 Komentar untuk "String, Object and the subroutine (JAVA IV)"

Back To Top