fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class sum{
  8. public int sum_int(int a, int b){
  9. return a+b;
  10. }
  11.  
  12. public double sum_double(int a, int b){
  13. return a+b;
  14. }
  15.  
  16. public char sum_char(int a, int b){
  17. char c=(char)(a+b);
  18. return c;
  19. }
  20. }
  21. class Ideone
  22. {
  23. public static void main(String[] args) {
  24.  
  25. sum obj = new sum();
  26. System.out.println("Sum of two var a and b is : "+obj.sum_int(50,47));
  27.  
  28. System.out.println("Sum of two var a and b is : "+obj.sum_double(50,47));
  29.  
  30. System.out.print("Sum of two var a and b is : "+obj.sum_char(50,47));
  31.  
  32. }
  33. }
Success #stdin #stdout 0.14s 50856KB
stdin
Standard input is empty
stdout
Sum of two var a and b is : 97
Sum of two var a and b is : 97.0
Sum of two var a and b is : a