Pin It

How to declare or make a Java method, class and fields as Deprecated ?.

Program to demonstrate how to declare or make a Java method, class and fields as Deprecated.





Click here to download complete source code 


@Deprecated
public class Calculator {
 
 @Deprecated
 public int sum(int x , int y){
  return x + y;
 }
 
 public int sum(int ... numbers) {
  int sum = 0;
  for(int number : numbers) {
   sum = sum + number;
  }
  return sum;
 }
 
 public static void main(String [] args) { 
  Calculator calculator = new Calculator();
  int result = calculator.sum(5, 10);
  System.out.println("The sum is : " + result);
  
  result = calculator.sum(5, 5, 10, 15);
  System.out.println("The sum is : " + result);
  
 }
 
}



Click here to download complete source code
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Related Posts Plugin for WordPress, Blogger...

Post your related queries below ...

comments powered by Disqus
Powered by Blogger.
 
© 2012 Learn Java by Examples Template by Hubber Spot