JavaQuick Tip: How to Remove a System Property in Java

Quick Tip: How to Remove a System Property in Java

Developer.com content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

Java Developer Tutorials

In this Java programming quick tip tutorial, developers will learn how to remove a system property using the System.getProperty method. This technique is illustrated in the Java code example below:

*/

import java.util.*;

public class DoubleBraces {
	
	public static void main(String[] args) 
	{  
		DoubleBraces doubleBraces = new DoubleBraces();
		doubleBraces.proceed();
	}

	private void proceed()  
	{
		//Ideal way of initializing the arrayList
		List arrayList = new ArrayList();
		arrayList.add("One");
		arrayList.add("Two");
		arrayList.add("Three");
		
		//Initializing using the double braces way {{ }}
		List arrayList2 = new ArrayList() {{
			add("One");
			add("Two");
			add("Three");
		}};
		
		System.out.println("ArrayList initialized the ideal way: " + arrayList);
		System.out.println("ArrayList initialized the double braces way: " + arrayList2);

	}
}

/*

Running this code example will result in the following output:

[root@mypc]# java DoubleBraces
ArrayList initialized the ideal way: [One, Two, Three]
ArrayList initialized the double braces way: [One, Two, Three]

Read more Java programming and development tutorials.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories