forked from tracksdata/fdcs-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSample.java
More file actions
32 lines (27 loc) · 976 Bytes
/
Sample.java
File metadata and controls
32 lines (27 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//import java.io.PrintStream;
/*
-> System is a class belongs to java.lang package
-> out is the static objct which belongs to java.io.PrintStream
-> Combining System.out, you get access to PrintSteam class object
-> On top of PritStream class object, we can invoke any methods in it
-> print() and println() belongs to PrintStream class
Note:
1. for each loop -> iterates only array content
*/
class Sample{
void f1(){} // need object
static void f2() {} // object does not required
public static void main(String[] cities){
for(String cityName:cities){
System.out.println(cityName);
}
// String c1=cities[0];
// String c2=cities[1];
// PrintStream ps= System.out;
//ps.println("--- Welcome....");
//System.out.println("City name is "+c1);
// System.out.println("City name is "+c2);
System.out.println("Total Cities: "+cities.length);
System.out.println(" --- Done ---");
}
}