what is the value if the following code is executed(Assume the value entered by user is 18)?
import java.util.*;
public class calculate {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num1, num2;
num2 = 6;
System.out.println("Enter value: ");
num1 = sc.nextInt();
num1 = num1 + 2;
num2 = num1 / num2;
System.out.println("Result = " + num2);
}
}
What are the values of numFruit, numOrange and numApples respecively after the following code is excuted:
int numOrange = 5;
int numApple = 10;
int numFruit;
numFruit = numOrange++ + numApple + ++numOranges;
What is the output after the following code is excuted?
char grades = 'B';
switch(grades){
case 'A':
System.out.println("A ");
Break;
case 'B':
System.out.println("B ");
case 'C':
System.out.println("C ");
Break;
default:
System.out.println("F ");
}
Today's questions can be quite tricky, especially for those who approached them with a Python mindset. 🤔
That was all for today have a good night and see you on tomorrow's session✌️
🔔Greetings, everyone!
I wanted to give you a friendly reminder that our session will begin in a mere 10 minutes. Please ensure that your working environment is prepared for the lab. Let's make the most of this session together! 😊
I wanted to give you a friendly reminder that our session will begin in a mere 10 minutes. Please ensure that your working environment is prepared for the lab. Let's make the most of this session together! 😊
Today, we will be proceeding with Lab 3. I highly encourage each of you to dedicate the next 15 minutes to independently tackling the question.
Consider the following line of code:
After executing the following on the command prompt what will the outputprinted on the screen?
java Output 3 2 8 2 4
class Output{
public static void main(String[] args){
if (args.length == 0) { return;}
int min = Integer.parseInt(args[0]);
for (int i=1; 1 < args.length; i++){
if (Integer.parseInt (args[ i ]) < min){
min = Integer.parseInt (args [i]);
}
}
System.out.println(min);
}
}After executing the following on the command prompt what will the outputprinted on the screen?
java Output 3 2 8 2 4
👍1
Consider the following java instruction that declares a variable to store the total number of students taking an exam:
``` int student_total;```
``` int student_total;```
Anonymous Quiz
24%
this variable declaration is not valid java synthax.
7%
this type int can be used only to store numbers greater than zero
2%
It would have been better to use the type double here
17%
Using the type double here nstead of int would cause a compiler error.
49%
none of the above
🔔Hello, everyone!
Just a quick reminder that our session will commence in just 10 minutes. Please take a moment to ensure that your working environment is ready for the lab. Let's make this session productive and enjoyable! 😊
Just a quick reminder that our session will commence in just 10 minutes. Please take a moment to ensure that your working environment is ready for the lab. Let's make this session productive and enjoyable! 😊
Today, we will be advancing to Lab 4. I strongly urge each of you to allocate the next 15 minutes to independently engage with the question and work on it.
Choose the correct statement for the code below:
public class AnyProg{
public static void main(String[] args){
int X, Y;
X = 7;
X++;
Y = X;
X = X * 3;
System.out.println("the value of Y is " + Y);
}
}