Results 1 to 4 of 4
- 12-04-2009, 07:21 AM #1
Member
- Join Date
- Nov 2009
- Posts
- 2
- Rep Power
- 0
- 12-04-2009, 07:32 AM #2
Member
- Join Date
- Apr 2009
- Location
- Pretoria, Gauteng, South Africa
- Posts
- 43
- Rep Power
- 0
I dont think your question is descriptive enough. where is the code you tried writing?
Tshegofatso Manakana
a.k.a Untouchable ™
- 12-04-2009, 08:13 AM #3
Member
- Join Date
- Nov 2009
- Posts
- 2
- Rep Power
- 0
here is the code, i don't know how to assign input from command line, pls advice.
class abc extends efg{
public int max(int a,int b){
int c=0;
if (a>b)
c=a;
else
c=b;
System.out.println("Max " + c);
return c;
}
public static void main(String args[]) {
int d=90;
int e=80;
abc v=new abc();
v.min();
v.max(d,e);
}
}
class efg{
public int min() {
int a= 1;
int b=30;
int c=0;
if (a<b)
c=a;
else
c=b;
System.out.println("Min " + c);
return c;
}
}
- 12-04-2009, 05:21 PM #4
don't know how to assign input from command line
Java Code:public class Test { Test(int[] ints) { for(int i = 0; i < ints.length; i++) { System.out.printf("ints[%d] = %d%n", i, ints[i]); } } public static void main(String[] args) { int[] n = new int[0]; if(args.length > 0) { n = new int[args.length]; for(int i = 0; i < n.length; i++) { n[i] = Integer.parseInt(args[i]); } } new Test(n); } }Java Code:C:\jexp>java Test 1 2 3 4 5 ints[0] = 1 ints[1] = 2 ints[2] = 3 ints[3] = 4 ints[4] = 5
Similar Threads
-
how to know the input value of integer
By ran830421 in forum New To JavaReplies: 15Last Post: 11-18-2009, 09:01 PM -
Input technique for unknown lines of input
By ducreative in forum New To JavaReplies: 16Last Post: 09-23-2009, 09:26 AM -
input to an integer (simply)
By chitwood in forum Advanced JavaReplies: 3Last Post: 03-18-2009, 06:34 AM -
Finding largest and smallest integer
By mlhazan in forum New To JavaReplies: 2Last Post: 01-12-2008, 10:30 PM -
how to take input and verify input in Java programs
By bilal_ali_java in forum Advanced JavaReplies: 0Last Post: 07-21-2007, 08:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks