The property of Java

Source: Internet
Author: User
Tags time in milliseconds

System.currenttimemillis () returns the current time in milliseconds.
System.GC () garbage collection
System.getproperties (). Returns the current system properties
System.getproperty (String key) Gets the system properties indicated by the specified key.
Because properties is a subclass of Hashtable, you can follow the map to fetch the data

Properties prop = System.getproperties ();
For (Object Obj:prop.keySet ())
{
String value = (string) prop.get (obj);
System.out.println (obj+ "::" +value);
}

Is it possible to dynamically load some information when the JVM starts?
-d< name >=< value >
Setting System Properties
JAVA-DHAHA=QQQ Systemdemo This is the setting information at the time of the virtual machine startup
String v = system.getproperty ("haha");
System.out.println ("v=" +v);//Here Gets the value of haha QQQ

System.load () will not be used
How to customize some unique information in the system
System.setproperty ("MyKey", "FDFDD");

 Public classsystemdemo{ Public Static voidMain (String args[]) {//The methods and properties in the System class are static. Out: Standard output, default is console, in: standard input, default is keyboard. //because properties is a subclass of Hashtable, that is, the map collection's//then the elements in the collection can be extracted by means of a map. //The collection is stored in a string that does not have a generic definition. //How to customize some unique information in the systemSystem.setproperty ("MyKey","FDFDD"); //gets the specified property information.String value = System.getproperty ("Os.name");//os.name::windows XPProperties prop =system.getproperties ();  for(Object obj:prop.keySet ()) {String value= (String) Prop.Get(obj); System. out. println (obj+"::"+value); }        //is it possible to dynamically load some information when the JVM starts? //-d< name >=< value >//Setting System Properties//JAVA-DHAHA=QQQ Systemdemo This is the setting information at the time of the virtual machine startupString v= System.getproperty ("haha"); System. out. println ("v="+V);//here to get the value of haha qqq        }}

The property of Java

Related Article

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.