자바 학습 사고

1265 단어
질문
  • 자바 의 클 라 스 파일 이름 첫 번 째 자 모 는 대문자 로 써 야 합 니 다. 클 라 스 의 클래스 이름 은 파일 이름과 같 아야 합 니 다
  • 같은 가방 에 있 는 클 라 스 는 가 져 올 필요 가 없습니다
  • package com.imooc;
    //1.     
    public class Telphone {
        //2.  (    )    
        float screen;
        float cpu;
        float mem;
        int var = 30;
        //3.      
    //            public   void,   void,  public,        ?
    //        
        void call(){
            /*
            int var = 40;
            System.out.println("var:"+var);
            int localVar = 10;//    
            System.out.println("localVar:"+localVar);
            System.out.println("var:"+var);
            */
            System.out.println("Telphone       !");
        }
        void sendMessage(){
            int localVar  = 20;//    
            System.out.println("localVar:"+localVar);
            System.out.println("var:"+var);
            System.out.println("screen:"+screen+" cpu:"+cpu+" mem:"+ mem +" Telphone       !");
        }
        
        public Telphone(){
            System.out.println("       !");
        }
        public Telphone(float newScreen,float newCpu,float newMem){
            screen = newScreen;
            cpu = newCpu;
            mem = newMem;
            System.out.println("          !");
        }
    }
    

    좋은 웹페이지 즐겨찾기