Java Se Basic Series (note)--Basicdatatype

Source: Internet
Author: User

The Java.lang.String class represents the immutable sequence of characters

Common methods of the string class: 1.public char charAt (int index); --Returns the character labeled Index

2.public int length ();

3.public int indexOf (String str); --Returns the subscript for the first occurrence of the string str in the string

4.public int indexOf (String str, int fromIndex);

5.public Boolean equalsignorecase (String another); --to determine if two strings are equal when ignoring case

6.public boolean startwith (String prefix); And then there's endwith.

7.public String subString (int beginindex); --Returns a substring from Beginindex

8.public String trim (); --remove whitespace before and after the string

9.public static String valueOf (int num); --can convert a base type to a string

10.public string[] Split (String regex); --a string can be separated by a specified delimiter, returning a segmented array of strings

The StringBuffer class represents a variable sequence of characters and can change its string

Common methods: 1.public stringbuffer append (..); --Add to end

2.public stringbuffer Insert (..); --Insert

3.public stringbuffer Delete (int start, int end);

4.public StringBuffer reverse (); --Used to reverse the string

Basic data Type wrapper class

int i = 100; I allocate on the stack

Integer i = new integer (100); Allocated at this time on the heap

public int intvalue (); --Returns the int value of the encapsulated data

public static int parseint (String s); --parses the string into int data and returns the data

public static Integer ValueOf (String s); --Returns an integer object in which the encapsulated integer data is represented by the string s

Math class: Provides a series of static methods whose method parameters and return value types are typically double

Random ()--Returns the number of 0.0-1.0 between

The Flie class represents the System file name (path and file name)

Common construction methods: public File (String pathname)--Create an object named pathname

/Public File (string parent, String child)

static property of File: String separator The path delimiter for the current system (forward slash universal!!!)

Common methods:--Accessing the properties of a file through a Files object

1.public Boolean canRead ()

2.public Boolean canWrite ()

3.public boolean isdirectory ()

4.public boolean isfile ()

5.public String GetName ()

6.public String GetPath ()

--Create an empty file or directory through the file object (in the case where the object refers to a file or directory that does not exist)

1.public Boolean createnexfile ()

2.public boolean mkdir ()--Create Path

3.public Boolean mkdirs ()--Create a series of paths

Java Se Basic Series (note)--Basicdatatype

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.