so… I stuck on importing Arrays in Java. Here are the code I wrote down.
// import the Arrays package here:
public class Newsfeed {
import java.util.Arrays;
public Newsfeed(){
}
public String[] getTopics(){
String[] topics = {"Opinion", "Tech", "Science", "Health"};
return topics;
}
public static void main(String[] args){
Newsfeed sampleFeed = new Newsfeed();
String[] topics = sampleFeed.getTopics();
System.out.println(Arrays.toString(topics));
}
}
and here is the answer:
// import the Arrays package here:
import java.util.Arrays;
public class Newsfeed {
public Newsfeed(){
}
public String[] getTopics(){
String[] topics = {"Opinion", "Tech", "Science", "Health"};
return topics;
}
public static void main(String[] args){
Newsfeed sampleFeed = new Newsfeed();
String[] topics = sampleFeed.getTopics();
System.out.println(Arrays.toString(topics));
}
}
What is the difference of putting import Arrays commend outside of class and inside of?
Help me for noob!