5) Java part of the common package features introduction

Source: Internet
Author: User

1> Java.lang (package) This is the basic class of the system, such as string, etc. are in this, this package isthe only package that can be used without importKey classes in the package:1>>object class: is the direct or indirect parent class for all classes in the class library. Common methods included: protected Object Clone () public boolean equals (Object obj) publicly final Class getclass () protecte d void Finalize () public String toString ()2>>system class: The system class is a powerful and useful special class that provides important tools such as standard input/output, runtime system information, and so on.     However, you cannot create an object of the system class, all of its properties and methods are static (static) and should be prefixed with system when referencing.          The System class has three properties, namely the standard input (in), standard output (out), and standard error output (ERR): public static PrintStream err;          public static printstream in;     public static printstream out;          Common methods of the system class: public static long Currenttimemillis ();          public static void exit (int status); public static void GC ();3>>string and StringBuffer class:      for string constants, to prevent modification, it is usually placed in the object of the string class .      for string variables, because it is often necessary to add, insert, Modifications, and so on, are generally stored in objects of the StringBuffer class. The  string object can be created with a simple assignment statement:      string name = "Petter", or you can create a string object based on the constructor of the string class:      string name = new String ("Petter"),  string common method:      public int Length ();       //Get string length      public int IndexOf (String str); //Find character      public int lastIndexOf (string str); //Reverse Lookup      public boolean startsWith (String prefix); //judging start substring       public boolean endsWith (String suffix);  //Judgment End substring      public Char charAt ( int index);     //Gets the character      public int compareTo (String str) according to the index;   //String comparison      public Boolean Equalsignorecase (String str); //determines equality      public Boolean equals (Object obj);  & nbsp Determine if the equivalent      public string concat (String str);   //connection string StringBuffer Common methods:      public int Length ();      public int capacity ();// Returns the current stringbuffer capacity      public int indexOf (String str);      Public StringBuffer append (String str);      public stringbuffer Delete (int start, int end); Nbsp;    public stringbuffer Insert (String str, int index);      public StringBuffer replace (int start, int end, String str),      public void Setcharat (int index, Char CH);      public String toString (); >>math class: The math class is used to perform some common mathematical operations, all of which are static class methods, so you don't have to create an object of the math class when you use it, and you can easily call these methods directly with the class title prefix. 2> java.io:This is all the input and output related classes, such as file operations, etc. 3> java.net:This is a network-related class, such as Url,urlconnection. 4>java.util:  Utility Class Library: In this package, Java provides some useful methods and data structures. For example, Java provides a date and calendar class to produce and get dates and times, provides random number classes to produce random numbers of various types, also provides stacks (stack), vector (vectors), bit sets (Bitset), and hash tables (Hashtable) class to represent the corresponding data structure.                              ┌java.util.bitset& nbsp                            │java.util.Calendar                             │   &NBSP ; └java.util.gregoriancalendar                        &N Bsp    │java.util.Date                          &NB Sp  │java.util.Dictionary                          &NBS P  │     └java.util.Hashtable    &nbsP                        │      & nbsp;     └java.util.properties                             │java.util.EventObject                &NB Sp            │java.util.ResourceBundle                ┌ General category ┤     ├java.util.listresourcebundle               │         │     └java.util.propertyresourcebundle│  │java.ut Il. local               │         │JAVA.UTIL.OBSERVABLE&NBS P              │         │java.util.Random              │         │java.util.StringTokenizer            &NBS P  │         │java.util.Vector               │&NBS P        │     └java.util.stackjava.util  ┤         └java.util.TimeZone               │        &NB Sp        └java.util.SimpleTimeZone               │  &nbsp ;               │         ┌java.util.Enumeration               ├ interface  ┤java.util.EventListener          &NB Sp    │         └java.util.Observer              &NBS P │                  │         ┌java.util.emptystackexceptio n               └ Exception class ┤java.util.missingresourceexception      &NBS P                      │java.util.NoSuchElementException  &nbsp ;                          └JAVA.UTIL.TOOMANYLISTENERSEXCE ption  5>java.sql:This is the database operation class, Connection, Statememt,resultset, etc.

5) Java part of the common package features introduction

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.