接口文檔,代碼層次(比如公共方法寫(xiě)在哪個(gè)class里),哪些為一大類(lèi)在一個(gè)包下,數(shù)據(jù)字典,就是介紹你這個(gè)項(xiàng)目的架構(gòu)讓后來(lái)的人怎么能容易參與開(kāi)發(fā),交接什么看這個(gè)就可以方便些,輔助作用的一個(gè)文檔一般都是項(xiàng)目經(jīng)理寫(xiě)
我們提供的服務(wù)有:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、祥云ssl等。為上1000家企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的祥云網(wǎng)站制作公司
由于在java開(kāi)發(fā)時(shí)我們得到的或者給別人的文件一般都是class文件,不會(huì)給出源文件,故編寫(xiě)一個(gè)簡(jiǎn)潔易懂的說(shuō)明書(shū)是必須的。
ps:?@param int[] arr 會(huì)有警告,可以刪掉 int []。
用工具解析文檔注釋?zhuān)簀avadoc工具
javadoc -d 目錄 -d -author ?-version ArrayTool.java
有時(shí)會(huì)提示出錯(cuò):找不到可以文檔化的公共或受保護(hù)的類(lèi)--在class前加一個(gè)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();//存儲(chǔ)沒(méi)輸入完的數(shù)
String first=new String();//第一個(gè)數(shù)
String second=new String();//第二個(gè)數(shù)
String symbol=new String();//存儲(chǔ)運(yùn)算符號(hào)
String remember=new String();
int point;//點(diǎn)過(guò)小數(shù)點(diǎn)否
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")//三角函數(shù)
{
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=="+/-")//正負(fù)轉(zhuǎn)換
{
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");//生成對(duì)象
myhomework.setSize(400,200);//設(shè)置大小
myhomework.setVisible(true);//設(shè)置成可見(jiàn)
}
public HomeWork61(String title)
{
super(title);//設(shè)置標(biāo)題
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();//存儲(chǔ)沒(méi)輸入完的數(shù)
String first=new String();//第一個(gè)數(shù)
String second=new String();//第二個(gè)數(shù)
String symbol=new String();//存儲(chǔ)運(yùn)算符號(hào)
String remember=new String();
int point;//點(diǎn)過(guò)小數(shù)點(diǎn)否
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")//三角函數(shù)
{
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=="+/-")//正負(fù)轉(zhuǎn)換
{
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");//生成對(duì)象
myhomework.setSize(400,200);//設(shè)置大小
myhomework.setVisible(true);//設(shè)置成可見(jiàn)
}
public HomeWork61(String title)
{
super(title);//設(shè)置標(biāo)題
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++)