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);
}
}Choose the correct statement for the code below:
public static Varargs{
public static void main(String[] args){
go(1, "hello");
go(2, "hello", "hi");
}
public static void go(int X, String... Y){
System.out.println(Y[Y.length - X] + " ");
}
}
CodeCraft Essentials
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); } }
📝EXPLANATION:
#Upon reevaluating the code:
#The variable X is declared and assigned a value of 7.
#X++ increments the value of X by 1, so X becomes 8.
#The value of X is assigned to Y, so Y also becomes 8.
#X is multiplied by 3, resulting in X being 24.
#Finally, System.out.println("the value of Y is " + Y); prints the value of Y, which is 8, to the console.
Therefore, the correct output for this code is:
#Upon reevaluating the code:
#The variable X is declared and assigned a value of 7.
#X++ increments the value of X by 1, so X becomes 8.
#The value of X is assigned to Y, so Y also becomes 8.
#X is multiplied by 3, resulting in X being 24.
#Finally, System.out.println("the value of Y is " + Y); prints the value of Y, which is 8, to the console.
Therefore, the correct output for this code is:
the value of Y is 8
That was all for today and see you tomorrow ✌️
If you have any question on the lab or on the exam questions you can send it to the group or you can dm this account: @coding2222
If you have any question on the lab or on the exam questions you can send it to the group or you can dm this account: @coding2222
How was today's session?
Anonymous Poll
89%
it was good and i am doing the labs and the questions daily
11%
No, it wasn't that useful, will be better to get back to the previous java lessons than labs
🔔Hello, everyone!
Quick reminder that our session will begin in a mere 5 minutes. Please ensure that your working environment is prepared for the lab. Let's make the most of this session together! 😊
Quick reminder that our session will begin in a mere 5 minutes. Please ensure that your working environment is prepared for the lab. Let's make the most of this session together! 😊
Today, we will move forward with Lab 5, which focuses on the fundamentals of Object-Oriented Programming (OOP). These labs and accompanying videos are truly remarkable as they efficiently cover the concepts we have been learning in just 20-30 minutes. I strongly suggest each of you to complete at least one lab per day. This practice will enhance your coding skills because programming is not solely about understanding the concepts; it is about actively applying and coding those concepts.😊
I encourage you to dedicate the next 15 minutes to independently tackle the lab question. Afterward, I will share the video with you.🎥
I encourage you to dedicate the next 15 minutes to independently tackle the lab question. Afterward, I will share the video with you.🎥
📝Now we will proceed to some exam question for practice and feel free to ask any questions.
consider the following program:
If this program runs and the user enters 1 when prompt for choice so which messages will be displayed by the program before terminating?
public class TestProg{
public static void main(String[] args){
int choice;
Scanner sc = new Scanner(System.in);
System.out.println("enter choice: ");
choice = sc.nextInt();
switch(choice){
case 1:
System.out.println("Gum ");
case 2:
System.out.println("Coke");
break;
default:
System.out.println("Error");
}
System.out.println("Goodbye");
}
}If this program runs and the user enters 1 when prompt for choice so which messages will be displayed by the program before terminating?
Consider a class, RecordAlbum, which has three attributes: the artist name (stored as a String), the record title (stored as a String) and the price (stored as a double). The constructor for this class takes values for the artist name, title and price respectively. Now consider the following array declarationarray declaration
Which one of the following instructions would add the album "I love Java", by the artists "Charatan & Kans" at a price of £12.99 into the 10th position in the array?
RecordAlbum[] store new RecordAlbum [100);
Which one of the following instructions would add the album "I love Java", by the artists "Charatan & Kans" at a price of £12.99 into the 10th position in the array?
Hello everyone ✋🏻
Today, we will be advancing to Lab 6 I strongly urge each of you to allocate the next 15 minutes to independently engage with the question and work on it.
Today, we will be advancing to Lab 6 I strongly urge each of you to allocate the next 15 minutes to independently engage with the question and work on it.