package
com.mmsindia.jpretty;
class
SayHello {
private
String
Hello = "Hello: ";
// Maximum
printable size
static
final
int MAXPRINT
= 5;
public
void say(String name, int val)
throws
Exception {
for(int i = 0; i < val; i++)
if(i < MAXPRINT)
System.out.println(Hello + name);
else throw new Exception();
}
public
static void main(String args[]) {
try
{
new SayHello().say(args[0],
Integer.parseInt(args[1]));
}
catch(Exception e) { System.out.println(e); }
}
} |
package
com.mmsindia.jpretty;
class
SayHello
{
public void say(String name, int val) throws Exception {
for(int i = 0;i < val;i++)
if(i <
MAXPRINT)
System.out.println(Hello + name);
else
throw new Exception();
}
public static void main(String args[]) {
try {
new SayHello().say(args[0],Integer.parseInt(args[1]));
}
catch(Exception e) {
System.out.println(e);
}
}
// Maximum printable size
static final int MAXPRINT = 5;
private String Hello = "Hello: ";
}
|