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 is a parameter in a function?
What is the instance of an object?
What is the final method?
5 Coding best practices you learned in java?
Why java is called not pure object oriented language?
Do I need java on my computer?
What is a stringbuilder?
Can inner class extend any class?
Why do we need singleton?
Explain the different forms of polymorphism?
How do I run java on windows?
what is enumset?
What is difference between fail-fast and fail-safe?
Can we have any other return type than void for main method?
Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?