Why does it say methods info(number s) and info(string s) aren't implemented if they're implemented in exactly the same way as info(object s)?
I feel like this part of the course has some completely abstract, poorly written exercices...
package pl.codegym.task.task15.task1521;
import java.math.BigDecimal;
/*
OOP: przeciążanie metod
*/
public class Solution {
public static class Tree {
public static void info(Object s) {
System.out.println("Drzewo nr " + s + ", metoda Object, parametr typu Short");
}
public static void info(Number s) {
System.out.println("Drzewo nr " + s + ", metoda Number, parametr typu Short");
}
public static void info(String s) {
System.out.println("Drzewo nr " + s + ", metoda String, parametr typu Short");
}
}
public static void main(String[] args) {
// Blok 2.
// Wywoływanie obiektów
new Tree().info((Object)new Integer("4"));
new Tree().info((Object)new Short("4"));
new Tree().info((Object)new BigDecimal("4"));
// Blok 3.
// Wywoływanie liczb
new Tree().info(new Integer("4"));
new Tree().info(new Short("4"));
new Tree().info(new BigDecimal("4"));
// Blok 4.
// Wywoływanie ciągów
new Tree().info(new String("4"));
new Tree().info(new Integer("4").toString());
new Tree().info(new Short("4").toString());
new Tree().info(new BigDecimal("4").toString());
}
}