getTime(): The getTime() method returns a date/time of the calendar in a Date object. Date objects are stored as an offset in milliseconds. The general form of the getTime() method is as follows:

Date getTime()

e.g. System.out.println(calendar.getTime());

setTime(): The setTime() method sets the current calendar’s date/time from the value of the specified date. The general form of the setTime() method is as follows:

void setTime(Date date)

e.g. calendar.setTime(date2);

  • Share/Bookmark

class Ques0357{
public static void main(String[] argv){
int s = 2;
switch (s) {
case 1:
System.out.println(”Fred”);
break;
case 2:
System.out.println(”Fast”);
case 3:
System.out.println(”Tech”);
default:
System.out.println(”default”);
}
}
}

The break statement is used inside the code block following the switch statement to terminate the execution of a statement sequence. As soon as a break statement is encountered, the program control is transferred to the first line of code that follows the entire switch statement.

  • Share/Bookmark