Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Is it possible to write JAVA program without including any
of the packages,such as "import java.io.*";
bcoz I instantly wrote a code without "import..." statement
and runned the program on command Line & it worked.
the code is:
class Person
{
String name;
int age;
Person(String s,int a)
{
name = s;
age = a;
}
accept()
{
System.out.println(name+"Hi!!!!!");
System.out.println(age);
}
}
class Demo
{
public static void main(Strings args[])throws
IOException
{
String name = args[0];
int age = Integer.parseInt(args[1]);
Person p = new Person(name,age);
p.accept();
}
}

Answer Posted / appa

In main method "Strings" throws exception nd import is
necessary for above code bcz IOException is Used,
If throws is removed it will execute for sure But at cmd
line if no values are passed then IndexOutOfBoundsException
is raised, so at cmd line u have to pass the values

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are arrays immutable in java?

1145


What is http client in java?

1140


if u open login & logout ,how can udisplay the timelogin & logout members ?

2317


What is complexity in java?

1108


Is Java a dying language?

1130


How do you remove all elements from an arraylist in java?

1095


Explain Basics of OOP Language in java

1106


Can Exception handling we can handle multiple catch blocks?

1085


What is the static variable?

1175


What do you understand by Header linked List?

1157


How do you convert an int to a double in java?

1110


How can we break singleton in java?

1014


How can we create an immutable class in java?

1119


What is flush () in java?

1068


What is a byte string?

1165