⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myclass.java

📁 java的oop编程important example
💻 JAVA
字号:
// This shows off the uses of this 

// This shows off the uses of "this". It is a non-public class
// just so the file name UseThis doesn't have to be the class name
// (some students found "This" in the class name confusing in this example).
public class MyClass {
  final static int MAXX=640, MAXY=480;  // low-res (VGA)
  int x, y;        // current location
  /** Construct a MyClass with x and y values */
  MyClass(int x, int y) {
    this.x = x;
    this.y = y;
        }
  /** Construct a MyClass with default values */
  MyClass() {
    this(MAXX/2, MAXY/2);   // Use the constructor above
        }

  public String toString() {
    return "[" + x + "," + y + "]";
  }

  /** Test main program */
  public static void main(String[] av) {
    System.out.println(new MyClass(300,100));
    System.out.println(new MyClass());
  }
}  
 
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -