Question 9 will give an error since implicit conversion is not possible from double to int
this occurs because on conversion from double to int data-loss can take place so, it raises an error.
Question 10
import java.util.Scanner;
public class Test{
public static void main(String
[]args){
Scanner sc = new
Scanner(System.in); //scanner object for taking inputs
System.out.println("Enter a number between 1 to 5");
int
choice=sc.nextInt(); //taking input from user
switch(choice){ //switch
case
case 1 : System.out.println('a');
break;
case 2 : System.out.println('e');
break;
case 3 : System.out.println('i');
break;
case 4 : System.out.println('o');
break;
case 5 : System.out.println('u');
break;
default : System.out.println("Wrong input"); //executes when user
inputs wrong data
}
}
}
Hope it Helped!!
Summer, 2018 9. What will be returned from the following method? public static int methodA(0 double...