Home
Tutorials
Core Java
Introduction To Java
Java Evolution
Overview of Java
Constants, Variables and Data Types
Java Operators
Branching Statements
Looping Statements
Classes, Objects and Methods
Inheritance
Array, String and Vectors
Java Interfaces
Java Packages
Applet Programming
Graphics Programming
Advanced Java
Java AWT
Java Event Handling
Java File Handling
Java MultiThreading
Java Swing-I
Java Swing-II
Exception Handling
Socket Programming
Java Database
Java RMI
Java Servlets
Java Beans
Programms
Projects
Downloads
Contact
Java Programming
!doctype>
Method Overloading in Java
/* ============================================ File Name : MethodOverloading.java WebSite : http://javaproglang.blogspot.in/ Created By : Bintu Chaudhary Email ID : bintu.chaudhary.mks@gmail.com ============================================ */ import java.io.*; class student { int a,b,c; void Sum() { a = 10; b = 20; c = a + b; System.out.println("\n\tSum of 1st Method="+c); } void Sum(int x) { a = b; c = x; System.out.println("\n\tSum of 2nd Method="+(a+c)); } void Sum(int x,int y,int z) { a = x; b = y; c = z; System.out.println("\n\tSum of 3rd Method="+(a+b+c)); } } class MethodOverloading { public static void main(String args[]) { student obj=new student(); obj.Sum(); obj.Sum(20); obj.Sum(10,20,30); } }
Output of "MethodOverloading.java"
Download Complete Program
-
Read more »
No comments:
Post a Comment
No comments:
Post a Comment