IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Java学习笔记

    Fish (fsh267@gmail.com)发表于 2015-04-04 00:00:00
    love 0

    工作需求,猛看Java,学习完了马士兵老师的第一阶段视频,做一下记录和总结。

    ##Hello world

    HelloWorld.java

    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello world !");
        }
    }

    ##变量

    byte int short long float double char boolean
    

    ##数组

    int a[];
    int [] a = new int[100];
    int [] b = new int[] {1, 2, 3};
    

    #类

    FaceObject.java

    interface dot {
        void fishing();
    }
    public class FaceObject {
        public static void main(String[] args) {
            Fish f = new Fish();
            f.fishing();
        }
    }
    
    class Fish implents dot{
    
        private int amount;
    
        void fishing() {
            System.out.println("Fsh is fishing");
        }
        
        int getAmount() {
            return amount;
        }
    
        Fish(int amount) {
            this.amount = amount;
        }
    
        Fish() {
            this.amount = 0;
        }
    }

    #END



沪ICP备19023445号-2号
友情链接