Skip to content

Instantly share code, notes, and snippets.

@P0huber
Created November 11, 2017 22:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save P0huber/3ac08d708c787964f3028636dc5773ad to your computer and use it in GitHub Desktop.
Save P0huber/3ac08d708c787964f3028636dc5773ad to your computer and use it in GitHub Desktop.
Method overloading. Метод перегрузки [Java]
public class MethodOverloading {
public static void main(String[] args) {
Integer b = 1000;
print(10);
print(b); // method overloading with Integer parameter
}
public static void print(int a){}
public static void print(Integer b){}
}
/*Int и Integer
Написать два метода: print(int) и print(Integer).
Написать такой код в методе main, чтобы вызвались они оба.
Требования:
1. Класс Solution должен содержать статический метод main().
2. Класс Solution должен содержать статический метод print() с параметром типа int.
3. Класс Solution должен содержать статический метод print() с параметром типа Integer.
4. Метод main() должен вызывать метод print() с параметром типа int.
5. Метод main() должен вызывать метод print() с параметром типа Integer.*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment