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 / shaik baji
HI Vijay Kumar Khadia,
I have tried with your above posted code but it
doesn't work so kindly can you explain me more detailed.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How do you remove an object from an arraylist in java?
What is the multi-catch block in java?
What are the special characters?
What is the use of jtable?
What about anonymous inner classes in java?
What are the drawbacks of singleton class?
What is the purpose of finalization in java programming?
What does provide mean construction?
Can a class be a super class and a sub-class at the same time? Give example.
What is java util concurrentmodificationexception?
What do you understand by access specifiers in Java?
What will be the output of round(3.7) and ceil(3.7)?
What are green threads in java?
Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?
How will you get the platform dependent values like line separator, path separator, etc., ?