Menu
Coddy logo textTech

Recap challenge #1

Lesson 6 of 12 in Coddy's Basics of Classes and Objects in Java course.

Let's recap classes!

challenge icon

Challenge

Easy

Write a class Point with,

Attributes -

  • x (integer)
  • y (integer)

Constructor that gets as input two integers and initializes x and y.

And a method print that gets no input and prints the point in the format:

(5, 2)

if x = 5 and y = 2.

Try it yourself

// Write code here

All lessons in Basics of Classes and Objects in Java