From the course: Coding Exercises: Scala

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

System properties

System properties

(arcade game sounds) - [Instructor] In this challenge, we'll find the values of system properties. System properties control a lot of the behavior of the Java virtual machine. Properties come from environment variables and from settings passed to the JVM, that's the Java virtual machine, when it is started. The Scala Standard Library provides an API for accessing system properties, which is in Scala.sys.SystemProperties. Your challenge is to find and print all the system properties. We want to see the name and the value of each property. Now pull the video and come back when you finish the challenge. (arcade game sounds) - Here's my solution. I'm starting, as always, with the empty file we provided for you. What I'm going to do is first, get all of the properties which I need to create a new instance of system properties for. Get an iterator from it. And then go over all of the elements in that iterator.…

Contents