接口文檔,代碼層次(比如公共方法寫在哪個class里),哪些為一大類在一個包下,數據字典,就是介紹你這個項目的架構讓后來的人怎么能容易參與開發,交接什么看這個就可以方便些,輔助作用的一個文檔一般都是項目經理寫
我們提供的服務有:成都網站設計、成都網站建設、微信公眾號開發、網站優化、網站認證、祥云ssl等。為上1000家企事業單位解決了網站和推廣的問題。提供周到的售前咨詢和貼心的售后服務,是有科學管理、有技術的祥云網站制作公司
由于在java開發時我們得到的或者給別人的文件一般都是class文件,不會給出源文件,故編寫一個簡潔易懂的說明書是必須的。
ps:?@param int[] arr 會有警告,可以刪掉 int []。
用工具解析文檔注釋:javadoc工具
javadoc -d 目錄 -d -author ?-version ArrayTool.java
有時會提示出錯:找不到可以文檔化的公共或受保護的類--在class前加一個public即可。
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.math.*;
public class HomeWork61 extends JFrame
{
JTextField memory=new JTextField();
JTextField number=new JTextField();
String before=new String();//存儲沒輸入完的數
String first=new String();//第一個數
String second=new String();//第二個數
String symbol=new String();//存儲運算符號
String remember=new String();
int point;//點過小數點否
class buttonlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String s=e.getActionCommand();
if(s=="1"||s=="2"||s=="3"||s=="4"||s=="5"||s=="6"||s=="7"||s=="8"||s=="9"||s=="0"||s==".")
{
if(s!=".")
before=before+s;
else
if(point==0)
{
before=before+s;
point=1;
}
number.setText(before);
}
else
if(s=="+"||s=="-"||s=="*"||s=="/")
{
if(first=="")
first=before;
else
{
second=before;
String result=new String();
double finalnumber=0;
if(symbol=="+")
finalnumber=Double.parseDouble(first)+Double.parseDouble(second);
if(symbol=="-")
finalnumber=Double.parseDouble(first)-Double.parseDouble(second);
if(symbol=="*")
finalnumber=Double.parseDouble(first)*Double.parseDouble(second);
if(symbol=="/")
finalnumber=Double.parseDouble(first)/Double.parseDouble(second);
if(symbol=="=")
finalnumber=Double.parseDouble(first);
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
point=0;
}
symbol=s;
before="";
point=0;
}
else
if(s=="=")
{
second=before;
before="";
String result=new String();
double finalnumber=0;
if(symbol=="+")
finalnumber=Double.parseDouble(first)+Double.parseDouble(second);
if(symbol=="-")
finalnumber=Double.parseDouble(first)-Double.parseDouble(second);
if(symbol=="*")
finalnumber=Double.parseDouble(first)*Double.parseDouble(second);
if(symbol=="/")
finalnumber=Double.parseDouble(first)/Double.parseDouble(second);
result=result.valueOf(finalnumber);
number.setText(result);
symbol="=";
first=result;
point=0;
}
if(s=="sin"||s=="cos"||s=="tan")//三角函數
{
if(first=="")
first=before;
before="";
String result=new String();
double finalnumber=0;
if(s=="sin")
finalnumber=Math.sin(Double.parseDouble(first));
if(s=="cos")
finalnumber=Math.cos(Double.parseDouble(first));
if(s=="tan")
finalnumber=Math.tan(Double.parseDouble(first));
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
symbol="=";
point=0;
}
if(s=="+/-")//正負轉換
{
if(first=="")
{
first=before;
before="";
String result=new String();
double finalnumber=Double.parseDouble(first);
finalnumber=-finalnumber;
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
symbol="=";
point=0;
}
else
{
String result=new String();
double finalnumber=Double.parseDouble(before);
finalnumber=-finalnumber;
result=result.valueOf(finalnumber);
number.setText(result);
before=result;
point=0;
}
}
if(s=="M+")
{
if(before!="")
{
if(remember=="")
remember=before;
else
{
double finalnumber=Double.parseDouble(remember)+Double.parseDouble(before);
remember=remember.valueOf(finalnumber);
}
before="";
point=0;
memory.setText("M");
}
}
if(s=="MR")
{
if(remember!="")
number.setText(remember);
else
number.setText("0.");
}
if(s=="MC")
{
memory.setText("");
remember="";
}
if(s=="MS")
{
if(before!="")
{
remember=before;
before="";
point=0;
memory.setText("M");
}
}
if(s=="C")//清除屏幕
{
before="";
first="";
second="";
symbol="";
point=0;
number.setText("0.");
}
}
}
public static void main(String[] args)
{
HomeWork61 myhomework=new HomeWork61("calculator");//生成對象
myhomework.setSize(400,200);//設置大小
myhomework.setVisible(true);//設置成可見
}
public HomeWork61(String title)
{
super(title);//設置標題
Container cp = getContentPane();
JPanel button=new JPanel();
JPanel result=new JPanel();
remember="";
before="";
first="";
second="";
symbol="";
point=0;
JButton c=new JButton();
button.setLayout(new GridLayout(4,6));
result.setLayout(new GridLayout(1,3));
JButton[] btn=new JButton[24];
btn[0]=new JButton("sin");
btn[1]=new JButton("MC");
btn[2]=new JButton("0");
btn[3]=new JButton("1");
btn[4]=new JButton("2");
btn[5]=new JButton("+");
btn[6]=new JButton("cos");
btn[7]=new JButton("MR");
btn[8]=new JButton("3");
btn[9]=new JButton("4");
btn[10]=new JButton("5");
btn[11]=new JButton("-");
btn[12]=new JButton("tan");
btn[13]=new JButton("MS");
btn[14]=new JButton("6");
btn[15]=new JButton("7");
btn[16]=new JButton("8");
btn[17]=new JButton("*");
btn[18]=new JButton("+/-");
btn[19]=new JButton("M+");
btn[20]=new JButton("9");
btn[21]=new JButton(".");
btn[22]=new JButton("=");
btn[23]=new JButton("/");
c=new JButton("C");
for(int i=0;i24;i++)
{
btn[i].addActionListener(new buttonlistener());
button.add(btn[i]);
}
c.addActionListener(new buttonlistener());
result.add(BorderLayout.EAST,memory);
result.add(BorderLayout.CENTER,c);
result.add(BorderLayout.WEST,number);
cp.add(BorderLayout.NORTH,result);
cp.add(BorderLayout.SOUTH,button);
number.setText("0.");
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.math.*;
public class HomeWork61 extends JFrame
{
JTextField memory=new JTextField();
JTextField number=new JTextField();
String before=new String();//存儲沒輸入完的數
String first=new String();//第一個數
String second=new String();//第二個數
String symbol=new String();//存儲運算符號
String remember=new String();
int point;//點過小數點否
class buttonlistener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String s=e.getActionCommand();
if(s=="1"||s=="2"||s=="3"||s=="4"||s=="5"||s=="6"||s=="7"||s=="8"||s=="9"||s=="0"||s==".")
{
if(s!=".")
before=before+s;
else
if(point==0)
{
before=before+s;
point=1;
}
number.setText(before);
}
else
if(s=="+"||s=="-"||s=="*"||s=="/")
{
if(first=="")
first=before;
else
{
second=before;
String result=new String();
double finalnumber=0;
if(symbol=="+")
finalnumber=Double.parseDouble(first)+Double.parseDouble(second);
if(symbol=="-")
finalnumber=Double.parseDouble(first)-Double.parseDouble(second);
if(symbol=="*")
finalnumber=Double.parseDouble(first)*Double.parseDouble(second);
if(symbol=="/")
finalnumber=Double.parseDouble(first)/Double.parseDouble(second);
if(symbol=="=")
finalnumber=Double.parseDouble(first);
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
point=0;
}
symbol=s;
before="";
point=0;
}
else
if(s=="=")
{
second=before;
before="";
String result=new String();
double finalnumber=0;
if(symbol=="+")
finalnumber=Double.parseDouble(first)+Double.parseDouble(second);
if(symbol=="-")
finalnumber=Double.parseDouble(first)-Double.parseDouble(second);
if(symbol=="*")
finalnumber=Double.parseDouble(first)*Double.parseDouble(second);
if(symbol=="/")
finalnumber=Double.parseDouble(first)/Double.parseDouble(second);
result=result.valueOf(finalnumber);
number.setText(result);
symbol="=";
first=result;
point=0;
}
if(s=="sin"||s=="cos"||s=="tan")//三角函數
{
if(first=="")
first=before;
before="";
String result=new String();
double finalnumber=0;
if(s=="sin")
finalnumber=Math.sin(Double.parseDouble(first));
if(s=="cos")
finalnumber=Math.cos(Double.parseDouble(first));
if(s=="tan")
finalnumber=Math.tan(Double.parseDouble(first));
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
symbol="=";
point=0;
}
if(s=="+/-")//正負轉換
{
if(first=="")
{
first=before;
before="";
String result=new String();
double finalnumber=Double.parseDouble(first);
finalnumber=-finalnumber;
result=result.valueOf(finalnumber);
number.setText(result);
first=result;
symbol="=";
point=0;
}
else
{
String result=new String();
double finalnumber=Double.parseDouble(before);
finalnumber=-finalnumber;
result=result.valueOf(finalnumber);
number.setText(result);
before=result;
point=0;
}
}
if(s=="M+")
{
if(before!="")
{
if(remember=="")
remember=before;
else
{
double finalnumber=Double.parseDouble(remember)+Double.parseDouble(before);
remember=remember.valueOf(finalnumber);
}
before="";
point=0;
memory.setText("M");
}
}
if(s=="MR")
{
if(remember!="")
number.setText(remember);
else
number.setText("0.");
}
if(s=="MC")
{
memory.setText("");
remember="";
}
if(s=="MS")
{
if(before!="")
{
remember=before;
before="";
point=0;
memory.setText("M");
}
}
if(s=="C")//清除屏幕
{
before="";
first="";
second="";
symbol="";
point=0;
number.setText("0.");
}
}
}
public static void main(String[] args)
{
HomeWork61 myhomework=new HomeWork61("calculator");//生成對象
myhomework.setSize(400,200);//設置大小
myhomework.setVisible(true);//設置成可見
}
public HomeWork61(String title)
{
super(title);//設置標題
Container cp = getContentPane();
JPanel button=new JPanel();
JPanel result=new JPanel();
remember="";
before="";
first="";
second="";
symbol="";
point=0;
JButton c=new JButton();
button.setLayout(new GridLayout(4,6));
result.setLayout(new GridLayout(1,3));
JButton[] btn=new JButton[24];
btn[0]=new JButton("sin");
btn[1]=new JButton("MC");
btn[2]=new JButton("0");
btn[3]=new JButton("1");
btn[4]=new JButton("2");
btn[5]=new JButton("+");
btn[6]=new JButton("cos");
btn[7]=new JButton("MR");
btn[8]=new JButton("3");
btn[9]=new JButton("4");
btn[10]=new JButton("5");
btn[11]=new JButton("-");
btn[12]=new JButton("tan");
btn[13]=new JButton("MS");
btn[14]=new JButton("6");
btn[15]=new JButton("7");
btn[16]=new JButton("8");
btn[17]=new JButton("*");
btn[18]=new JButton("+/-");
btn[19]=new JButton("M+");
btn[20]=new JButton("9");
btn[21]=new JButton(".");
btn[22]=new JButton("=");
btn[23]=new JButton("/");
c=new JButton("C");
for(int i=0;i24;i++)
網頁標題:代碼說明文檔java 代碼說明文檔app
分享鏈接:http://m.newbst.com/article16/hihpdg.html
成都網站建設公司_創新互聯,為您提供面包屑導航、網站改版、電子商務、軟件開發、用戶體驗、
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯