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


Please Help Members By Posting Answers For Below Questions

how to know the total memory occupied by the objects in the ArrayList(Array list may contain duplicate objects)

1901


Can java program run without jre?

565


What are the differences between include directive and include action?

542


What is entry in java?

527


Is java 11 paid version?

506






Explain about assignment statement?

594


What is difference between static variable and global variable?

544


What is the synchronized method modifier?

590


Why there are some null interface in java? What does it mean?

640


What is the difference between JDBC 1.0 and JDBC 2.0?

2704


What is Garbage Collection in Java

607


What are register variables what are the advantages?

444


How can you handle java exceptions?

523


What are keywords in java?

573


Why declare Main() method as a static in java ?

593