JAVA 17 (various other objects)

Source: Internet
Author: User

the properties and methods in System are static. In: standard input, default keyboard out: Standard output, default console GetProperties: System Information System.setproperty ("MyKey", "myvalue") String System.getproperty (" MyKey ")Runtime does not have a constructor and cannot be a new object. Gets the object through static Runtime GetRuntime (). Method: Exec (String command)//execute a command example: Import java.io.ioexception;import java.util.*;p ublic class Test {public static void Main (string[] args) throws IOException, interruptedexception {Runtime r = runtime.getruntime (); Process P =r.exec ("Winmine.exe xxx". TXT ");//execute the Change program open the following file Thread.Sleep (1000); P.destroy ();//Kill the child process. }}DateYou can new object, method introduction import java.io.ioexception;import java.util.*;import java.text.*;p ublic class Test {public static void main (string[] args) throws IOException, interruptedexception {Date d = new Date (); SOP (d);//print time not to understand, print in a format Simpledateforma T SDF = new SimpleDateFormat ("yyyy mm DD day hEh:mm:ss");//The month-date pattern encapsulates String time =sdf.format (d);//Call method, format the specified object SOP (time); } public static void sop (Object obj) {System.out.println (obj);}}Calender Class abstract classThe object can be obtained by means of calender C = calender.getinstance (), SOP (C.get (calender.year); a whole bunch of time-related, follow-up.Math Maths classProperty Math.EMath.pi Method Math.Abs (int/float/double ...) Absolute math.sin/cos/tan/asin/acos/atandouble Math.ceil (double A)//returns the double value of the smallest integer maximum to the specified data double Math.floor (double A)/ /returns a Double value Int/long math.round (float)//rounded double math.pow (2,3), which is the largest integer minimum of the specified data; 2 of three Power double math.random ()//returns a random double value greater than or equal to 0.0 and less than 1.0. 

JAVA 17 (various other objects)

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.