Admin[dElmARk] Forum Owner
Posts : 78 EC-Points : 6304 Thanked : 21 Join date : 15/10/2011 Age : 29 Location : Philippines
Hacker's Info Hacking Exp: (0/0) Hacker Type: White Hat Hacking Title:
| Subject: Data Java. Fri Nov 25, 2011 11:21 am | |
| startData.java - Code:
-
import java.util.*; public class startData{ public static void main(String[]args){ Scanner xx = new Scanner(System.in); Data lol = new Data(); System.out.print("Input x"); int x = xx.nextInt(); System.out.print("Input y"); int y = xx.nextInt(); System.out.print("Input z"); int z = xx.nextInt();
System.out.println(lol.add(x)); System.out.println(lol.add(x, y)); System.out.println(lol.add(x, y, z)); } } Data.java - Code:
-
class Data{ int x, y; public int add(int x){ return x+5;} public int add(int x, int y){ return x+y;} public int add(int x, int y, int z){ return x+y+z; } } |
|