Creating an Array Explicitly
Sun Sep 25 2022 01:40:43 GMT+0000 (Coordinated Universal Time)
Saved by
@cruz
#javascript
public class Newsfeed {
public Newsfeed(){
}
// Create getTopics() below:
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(topics);
}
}
content_copyCOPY
Comments