Created
November 11, 2017 22:23
-
-
Save P0huber/3ac08d708c787964f3028636dc5773ad to your computer and use it in GitHub Desktop.
Method overloading. Метод перегрузки [Java]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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