/** File類*/如何獲得系統(BlueJ的)分配唯一的編號順序
public class File {
// The File name.
private String name;
// The date file created.
private String date ;
// The type of file - audio, image, video, doc.
private String type;
// The size of the file - 2MB, 2KB etc.
private String size;
/**
* Create a file
*/
public File(String Filename)
{
name = Filename;
date = ("MM/dd/yyyy");
type =();
size =();
}
/**
* Return the name of a File.
*/
public String getName()
{
return name;
}
/**
* Update system number when called to the output terminal
*/
public void Systemnumber()
name.increment();
if(name.Filename() == 0) { // it jus rolled over !
i.increment();
}
updateDisplay();
}
/**
* Print File description to the output terminal
*/
public void updateDisplay()
public String s = String.format ("%02d", i); // gives you "001"
for (int i = 001; i < 1000; i++) {String sequence = String.format("%02d", i); }
{
return (i + "", '$this.Name + " " + $this.date + " " + $this.type + " " +$this.size; }
/**
* This method is called everytime Increment the return value one, rolling over to zeor if the limit is reached
*/
public void updateDisplay()
{ displayString = name.
(
value = (value +1) % limit;
)
}
請正確格式化您的代碼,這使得它更容易閱讀! – berry120 2011-08-02 20:53:38
請在[如何創建最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)上閱讀本FAQ,並澄清您遇到的問題。 – bacar 2016-05-26 23:22:36