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 / anandkumar

No its not Possible. but if you are not using the Exception it will be possible.....

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does java have two ways to create child threads?

967


Suppose if we have variable ' I ' in run method, if I can create one or more thread each thread will occupy a separate copy or same variable will be shared?

1064


How will you serialize a singleton class without violating singleton pattern?

1967


How does queue work in java?

993


What does compareto () do in java?

1004


Why we use set in java?

1011


Where and how can you use a private constructor?

1003


What is treemap in java?

956


What is join () in java?

971


Tell us something about set interface.

1008


what is the difference between thread and runnable types? : Java thread

1013


Why does java not support operator overloading?

1149


What is a functional interface?

1049


How to sort an array from smallest to largest java?

996


Can we overload the constructors?

1002