There are 8 basic data types in encapsulated Java. Because these data types are not objects at the object level, they are passed by value to the method and cannot be referenced. By means of creating or accessing a basic data class form, it can be encapsulated by the corresponding "encapsulation class".
Eg:int the encapsulated class integer of the data type.
Class Cmdarg
{
public static void Main (String args[])
{
int sum=0;
for (int cut=0;cut<args.length;cut++)
Sum+=integer.parseint (Args[cut]);
System.out.println ("and for" +sum);
}
}
Javac Cmdarg.java
Java Cmdarg 10 5 3
And for: 18
The Parsein () method in the integer class executes the corresponding integer value from the string.
10,5,3, storing the string array args[], but not the code that passed the value into the array, is it the default? is the default constructor for Cmdarg? It doesn't feel like it. This is a bit strange.
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.