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 a cup of java?
How to write custom exception in java?
Can a private method of a superclass be declared within a subclass?
What do you mean by access modifier?
Can a method be overloaded based on different return type but same argument type?
Explain the difference between an Interface and an Abstract class?
Write a program to print the pattern given below
What is a flag value?
What do you understand by classes in java?
What is role of void keyword in declaring functions?
What string is utf8?
State the difference between strings and arrays.
What is the use of static methods?
What type of value does sizeof return?
What is the purpose of the System class?