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
What was java originally called?
What is use of set in java?
what is method reference in java 8?
How do you clear a method in java?
how can you take care of mutual exclusion using java threads? : Java thread
What is numeric function?
Why do we use return statement?
How do you start a thread?
Give me example of derived data types.
Why java strings are immutable in nature?
What is volatile data type?
What is a null class?
How do you escape a string?
What are the differences between throw and throws?
What are the different ways of implementing thread? Which one is more advantageous?