CodeCraft Essentials
222 subscribers
187 photos
39 videos
49 files
164 links
Download Telegram
🔔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! 😊
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.
Now, let's move on to addressing some exam questions
Consider the following line of code:
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
?
Anonymous Quiz
0%
4
15%
3
21%
8
65%
2
🔔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! 😊
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.
Now, we will proceed to tackle a few exam questions.🗓
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! 😊