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
What is the difference between stringbuffer and stringbuilder?
What is the size of int?
What is a treemap in java?
Can we create constructor in abstract class ?
What is mean by encoding?
Give an example of use of pointers in java class.
Can a class be declared as protected?
Is string pool garbage collected?
What is the class in java?
Does java return by reference?
What are the Static and Dynamic Variables? Differentiate them.
What is the difference between method overriding and overloading?
What is a protected method?
Why pointers are not used in java?
If an application has multiple classes in it, is it okay to have a main method in more than one class?