Java Practice Problems
Sort by: Curriculum unit & section · Just problems, by category
Show: Everything · Lessons · Worksheets · Problems
- plotPoint Geometry & Shapes 1.2 Write a method that plots a point at (x, y) in the color given, then prints "plotted" (no…
- Declare a student record Java Basics 1.2 🌶️ A student is taking 6 courses, has a GPA of 3.5, is currently enrolled, and is named Mari…
- Print two lines with one statement Java Basics 1.3 🌶️ Write code in the box that prints these two lines, using a single System.out.println stat…
- Seconds to minutes and seconds Java Basics 1.3 🌶️🌶️ The variable totalSeconds holds a length of time in seconds. The three locked lines at th…
- Split a two-digit number Java Basics 1.3 🌶️ The variable number holds a two-digit whole number. The two locked lines at the bottom pr…
- Swap two values Java Basics 1.4 🌶️🌶️ The program below gives first and second their starting values, and its last two lines (l…
- Update an account balance Java Basics 1.4 🌶️ The variable balance holds the amount in an account, deposit is a deposit being made, and…
- Round to the nearest whole number Java Basics 1.5 🌶️🌶️ The variable temperature holds a positive temperature with a decimal part, like 71.6. The…
- printAverage Java Basics 1.5 🌶️ The method below is supposed to calculate the average number of points scored per game an…
- Average of four test scores Java Basics 1.5 🌶️🌶️ test1, test2, test3 and test4 are four whole-number test scores. The locked line at the b…
- sumDigits One Loop 2.4 🌶️🌶️🌶️ Given a non-negative int n, return the sum of its digits. sumDigits(126) returns 9 (1+2+6…
- caesarShiftString One Loop 2.7 🌶️🌶️🌶️ Extra Write a method that takes one String parameter, s, and one int parameter, shift, and retu…
- Vector2D.Magnitude Objects & Classes 3.5 🌶️ Below is the definition of a Vector2D class, representing a two dimensional vector - an …
- printSquares One Loop 4.2 Given n, print the square of each integer from 1 to n, one per line, using System.out.pri…
- capitalizeAll One Loop 6.3 Given an ArrayList<String> of words, return a new ArrayList<String> containing each word …
- sumFile Files & I/O 6.4 Given a File containing one integer per line, construct your own Scanner over it and retu…
- findMax 2D Arrays 8.3 Given a 2D array of ints, draw the grid, find the maximum value, highlight the cell it wa…
- transpose 2D Arrays 8.4 Given a rectangular 2D array grid, return its transpose: a new 2D array where rows and co…