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
How to find the given number is a prime number or not by getting input from the user
Why singleton class is used in java?
what is interface in java? Explain
What is instance synchronization?
Why we use multi threading instead of multiprocessing?
What technique is carried out to find out if a particular string is empty?
When can you say a graph to be a tree?
What is the use of a copy constructor?
What is http client in java?
How do you sort in java?
How do you declare a destructor in java?
Which collection is ordered in java?
What is meant by oops concept in java?
Can a class be final?
Does it matter in what order catch statements for filenotfoundexception and ioexception are written?