//第一个
1
public class Cardemo{ 2 public static void main(String[] args){ 3 Car carwind = new Car(60,"red","west"); 4 carwind.speed = 60; 5 carwind.color = "red"; 6 carwind.direction = "west"; 7 8 System.out.println("The speed of car is " + carwind.speed); 9 System.out.println("The color of car is " + carwind.color); 10 System.out.println("The direction of car is " + carwind.direction); 11 } 12 } 13 class Car{ 14 //定义四个成员变量(属性) 15 int speed; 16 String color; 17 String name; 18 String direction; 19 }

更多相关文章

  1. 包含带标记的值的XML属性文件
  2. 环境变量在cron中看不到
  3. JAVA中的反射只获取属性的get方法
  4. java中的成员变量和局部变量的区别
  5. 如何在Spring中读取具有相同键的多个属性?
  6. 如何在另一个类中使用静态类中的变量?
  7. JAVA 静态方法和静态变量和final和※静态import※
  8. Linux(Centos7.X ) 配置Java 环境变量
  9. java通过映射取得方法对一个类的变量进行赋值

随机推荐

  1. android限制文本长度
  2. android ListView 示例1 entries 指定一
  3. Android:解决ListView按下后上下滑动背景
  4. Android studio was unable to find a va
  5. Android 使用iperf测试wifi吞吐量
  6. 二、 Android中gravity与layout_gravity
  7. Linux下Android(安卓)ADB驱动安装详解
  8. JNI 入门
  9. 8. android Tab 选项卡控件
  10. Android Service AIDL 远程调用服务 【简