Working with Java’s Built in Objects – Programming Assignment

12:Working with Java’s built in Objects

Write a Java program that does the following. This can all be done inside the main() method.

1. Using the System object, use the getenv method and display the result for the argument “OS”.

FYI: From the Windows cmd window – type “set” to get a list of available system variables. The key-value pairs listed are what the getenv method can obtain.

2. Using the System object, display the current time in milliseconds since Jan 1 1970. Hint: There is a method that does just that.

3. Create a String named awake and assign it the value “true”. Create a primitive boolean variable named isAwake. Using the Boolean class, create the string result of isAwake and assign it to the string awake and display the result. Note to use the wrapper class Boolean instead of boolean.

4. Create a Double variable and assign it the value of 100. Using the Double class, display the value as a HexString. Note to use the wrapper class Double instead of double.

The results should be as follows. Your results for OS may vary and Milliseconds will vary. Boolean and Hex results should match as below.

OS = Windows_NT
Milliseconds since Jan 1 1970 = 1554768376670
My Boolean result = true
My Hex Result for 100 = 0x1.9p6

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.