CodeGym/Java Course/Java Core/Practice overloading methods

Practice overloading methods

Available

"Hello, Amigo! It's me—again. I've got a gift for you: a bunch of interesting assignments. No need to thank me. Take it easy!"

3
Task
Java Core,  level 2lesson 4
Locked
We're on overload!
It is a good thing that Java supports method overloading! It solves so many problems and gives us so much freedom! So, let's add it to your arsenal and continue to master it through practice. This time let's write two methods named print. One will print a whole number, and the other a string.
3
Task
Java Core,  level 2lesson 4
Locked
int and Integer
At the end of the first quest, you learned that every primitive type in Java has a corresponding non-primitive class. Soon these non-primitives will be everywhere, mark my words! But for now, we'll write two different screen output methods: one for the primitive int and a second for the non-primitive Integer class.
3
Task
Java Core,  level 2lesson 4
Locked
Freedom of the press
In CodeGym, we believe in freedom of the press. No secrets here! Write whatever you'd like, whenever you'd like. Just be sure to create special methods for it, so we can practice overloading these methods. So, write five different print methods with take different parameters. Which ones? Whatever comes to mind!
3
Task
Java Core,  level 2lesson 4
Locked
Three methods and a minimum
Is it possible to compare two numbers of different types? The overwhelming majority of humans can handle this task. But for robots, it is really difficult. For them, trying to compare a double with an int would be like asking a human to compare something warm with something soft. Let's not wear out the robots: create 3 overloaded min methods using long, double, and int.
3
Task
Java Core,  level 2lesson 4
Locked
Three methods and a maximum
We've once again entered the orbit of Planet Linear Chaos, home of the Ordered Isomorphs. Anyone who wants a visa must first solve a sorting and ordering problem. This time they are being very nice to you. They're giving you a super simple task: you need to create 3 methods that return the maximum of two longs, doubles, or ints.
Comments (16)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Boat
Level 40 , Germany, Germany
24 April 2023, 08:10
I'm slightly confused here. Syntax was supposed to be the easy part with Core dramatically picking up the intensity, yet so far the Core quest is literally just repeating exact lessons from the Syntax quest and repetitive tasks ad nauseum.
Anonymous #10782038 Java Developer at Microsoft
29 March 2024, 23:20
They must have changed something because this is in the Syntax group still.
Andrew Evans
Level 17 , San Jose, Canada
22 February 2022, 20:53
Pretty repetitive. Just basically grabbing code from the different exercises and modifying it. Needs to be more difficult, it's core not syntax
Stanislav Mayer
Level 15 , Czech Republic
14 February 2022, 14:50
way too easy, again...
Binesh
Level 16 , India
9 November 2019, 01:11
Slow & Steady....
Ash Ka
Level 13 , Calgary, Canada
28 October 2019, 16:12
Marching on!
Renat Mukhametshin
Level 16 , Pervouralsk, Russain Federation
30 August 2019, 10:33
let's go forward
holybible
Level 28 , Plovdiv, Bulgaria
26 August 2019, 13:14
sweet moving on
Isenraf
Level 20 , Douala, Cameroon
3 July 2019, 06:05
pass in a new Integer object as argument to the parameter reference in the second print method
Bert Doe
Level 22 , Flanders, Belgium
21 April 2019, 22:30
moving on..!
DEADPOOL
Level 14 , Atlantis, INDIA
19 August 2018, 04:10
how to send Integer value as parameter..lol
Azhar Iqbal
Level 18 , Multan, Pakistan
24 September 2018, 20:52
create object of the Integer class and pass to it. like Integer obj = new Integer(10);
علي حجار
Level 18 , Bursa, Turkey
31 December 2018, 06:18
you can do it using casting inside brackets like this ((Integer)10)
Oleh
Level 32 , Kyiv, Ukraine
27 February 2019, 15:17
Seems like "new Integer(int)" constructor is deprecated from jdk 9. Oracle advices to use Integer.valueOf(int) for better perfomance.
Ivaylo Trifonov
Level 25 , Madrid, Spain
13 April 2019, 16:41
Casting, is what I did. :)
Devonte A
Level 18 , Rubery, United Kingdom
28 June 2020, 13:25
Integer a = 5; also works.