?? mystock.java
字號:
package examples.classes;
/** A class definition to demonstrate the use
* of the this reference
*/
public class MyStock {
private int stockNumber;
private float price;
public MyStock setStockNumber( int stockNumber ) {
this.stockNumber = stockNumber;
return this;
}
public MyStock setPrice( float price ) {
this.price = price;
return this;
}
public int getStockNumber() {
return this.stockNumber;
}
public float getPrice() {
return this.price;
}
/** The test method for the class
* @param args Not used
*/
public static void main( String[] args ) {
MyStock x = new MyStock(), y = new MyStock();
x.setStockNumber( 1235693 ).setPrice( 123.34F );
y.setStockNumber( 1234833 ).setPrice( 11.57f );
System.out.println( x.getStockNumber() + " "
+ x.getPrice() );
System.out.println( y.getStockNumber() + " "
+ y.getPrice() );
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -