Create a short program that demonstrates one of the functions shown below:
Date class: long getTime()
Random class: set the seed and generate a random number
Date class: toString()
Date class: compareTo()
Point 2D class: distance()
String class: replace
String class: split
String class: match
StringBuilder class: append
StringBuilder class: insert
StringBuilder class: reverse
StringBuilder class: replace
StringBuilder class: substring
import java.util.Date; import java.util.Random; public class Demonstrate { public static void main(String[] args) { Date date = new Date(); System.out.println("Time is " + date.getTime() + " milli-seconds"); Random random = new Random(); random.setSeed(10); // set random seed System.out.println("Current time is " + date.toString()); } }
Get Answers For Free
Most questions answered within 1 hours.