khirulnizam

Basic Java Overloading

Mar 5th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class Overloading {
  2. void info(){
  3. System.out.println("Basic house");
  4. }
  5. void info(String name){
  6. System.out.println("House for "+name);
  7. }
  8. void info(String name, int num){
  9. System.out.println(num+
  10. " houses for "+name);
  11. }
  12. }
  13. public class Overload{
  14. public static void main(String[] args) {
  15. // TODO Auto-generated method stub
  16. Overloading ov = new Overloading();
  17. ov.info("Ahmad", 2);//method ke-3
  18. ov.info();//method ke-1
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment