progamming
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”.
Need assignment help for this question?
If you need assistance with writing your essay, we are ready to help you!
OUR PROCESS
Order
Payment
Writing
Delivery
Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality
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