Workbook 6.12
From the Java Bootcamp Resources
, launch Workbook 6.12
.
Task 1
You're feeling good about these lottery numbers.
int[] ticket = {34, 43, 45, 65, 21, 54};
Use Arrays.copyOf()
to copy all the elements of ticket
into ticket2
. Change the third value to 54.
int[] ticket = {34, 43, 45, 65, 21, 54}; int[] ticket2 = // 34 - 43 - 54 - 65 - 21 - 54.
Task 2
Create a function that prints the ticket numbers. Follow the steps below:
/** * Function name -- printTicketNumbers * @param ticket ( int[] ) * * Inside the function: * 1. Use a loop to print the numbers in one line. * System.out.print(ticket[i] + " "); * * 2. After the loop, print two new lines. * System.out.print("\n\n"); * */
Call the function for each ticket:
Visualizing the Runtime
After you solve this workbook, I still recommend watching the video solution on Udemy.
It will show you how to visualize the runtime using Visual Studio Code.
Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
4.7
43 students
5
91%
4
2%
3
0%
2
0%
1
7%
Written Reviews
There are no written reviews yet.