Discuss / Java / 定义字段

定义字段

Topic source

I WILL.

#1 Created at ... [Delete] [Delete and Lock User]
public class Main {    public static void main(String[] args) {        City bj = new City();        bj.name = "Beijing";        bj.latitude = 39.903;        bj.longitude = 116.401;        System.out.println(bj.name);        System.out.println("location: " + bj.latitude + ", " + bj.longitude);    }}class City {    public String name;    public double latitude;    public double longitude;}

  • 1

Reply