-
importing libraries
Hi, i'm new to the forum and i've been searching but can't seem to get the info i need.
I'm doing a bit of coursework and one of the questions state if I remove java import.io from the code below what would happen.
You should know i removed it and nothing happen. Can anyone explain why.
Code:
java import.java.io.*;
class ASimpleExample{
public static void main(String []args){
System.out.println("Hello, World!");
}//close main method
}//close class
If it's something already discussed my sincerest apologies but I appreciate the help.
-
Did you read the Java API for that library?
-
And also, please use code tags next time, when you are posting code segments. Unformated codes are really hard to read.
-
The line should be
Did you try compiling and running your code again after you removed it?
-Gary-
-
-
Sorry, that was a mean trick question, and your instructor already pulled one trick question on you. Yes, the program compiles and runs just fine without that import. The reason is simply that the program does not use any code from the java.io libraries.
-Gary-
-
More importantly, OP is worried that as you said he believe there is a trick, and should end with an error. Since nothing is going wrong he's worried.
-
thanks for the help
I appreciate the help, turns out all the trick to the question was that the code had my importing io but there was nothing but input into the code. all the code was doing, print hello world.
thanks again for the help i realy appreciate.
-
So you've sorted out the problem yourself. Could you please mark the thread solved then.