CodeCraft Essentials
222 subscribers
187 photos
39 videos
49 files
164 links
Download Telegram
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:
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
🔔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! 😊
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.🎥
📝Now we will proceed to some exam question for practice and feel free to ask any questions.
consider the following program:

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

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?
👍1
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 there won't be exam questions practice see you all tomorrow✌️
👋Hey, everyone!

Just a friendly reminder that our session is starting in just 10 minutes. Please make sure you're ready with your working environment set up for the lab. Let's make the most of this session together and have a great time! 😊
Today, we will be practicing lab 7. I strongly urge each of you to allocate the next 15 minutes to independently engage with the question and work on it.
👍1