
import javaappletApplet;//导入系统applet类
import javaawt;
import javaawtevent;
import javautil;
import javalang;
public class Students extends Applet implements ActionListener//类的声明
{
Vector StuInf=new Vector();
StudentInf SI;
String xm;//定义字符串
String bj;
int i,j,xh,cj;//定义整数
static int mid;
Label prompt1=new Label("学生成绩管理系统");//创建标签
Label prompt2=new Label(" 用户:");
Label prompt3=new Label(" 密码:");
Label prompt4=new Label(" 班级:");
Label prompt5=new Label(" 成绩:");
TextField input1=new TextField(8);//创建能容纳8个字符的单行文本框
TextField input2=new TextField(8);//创建能容纳8个字符的单行文本框
TextField input3=new TextField(8);
TextField input4=new TextField(8);
Button btn1=new Button("登录");//创建按钮
Button btn2=new Button("增加");
Button btn3=new Button("修改");
Button btn4=new Button("删除");
//查找方法
public void search(int k)//按编号查找
{
boolean exist=false;
int low=0;
int high=StuInfsize()-1;
while(low<=high)
{
mid=(high+low)/2;//最高分与最低分平均值
StudentInf a1=(StudentInf) StuInfelementAt(mid);
if(a1getStuNo()==k)
{
SI=(StudentInf) StuInfelementAt(mid);
String x = StringvalueOf(SIgetStuNo());
exist=true;
input1setText(SIgetname()); //在该行文本框输出学生姓名
input1selectAll();
input2setText("0"+x);
input3setText(SIgetClassNo());//在该行文本框输出学生号
if(SIgetLevel()==-1)
input4setText("未参加考试");
else
{
String y = StringvalueOf(SIgetLevel());//将获取的成绩字符转换
input4setText(y);
}
break;
}
else if(a1getStuNo()<k)
low=mid+1;
else
high=mid-1;
}
if(exist==false)
{
input1setText("无此学号学生信息");
input1selectAll();
}
}
//添加方法
public void Insert(StudentInf q)//添加学生信息
{
int i=0;
if(StuInfisEmpty()==true) //学生信息进行设置
{
StuInfaddElement(q);
input1setText("");
input2setText("");
input3setText("");
input4setText("");
}
else
{
StudentInf xh;
xh=(StudentInf) StuInffirstElement();
while(xhgetStuNo()<qgetStuNo())
{
i++;
if(i<StuInfsize())
xh=(StudentInf) StuInfelementAt(i);
else
break;
}
if(xhgetStuNo()==qgetStuNo())
{
input2setText("此学生信息已存在");
input2requestFocus();
input2selectAll();
}
else
{
StuInfinsertElementAt(q,i);
input1setText("");
input2setText("");
input3setText("");
input4setText("");
}
}
}
package demo1;
import javaioBufferedReader;
import javaioFileNotFoundException;
import javaioFileReader;
import javaioIOException;
/
@ClassName: BufferedDemo
@Description: (获得Java文件中的空行和注释行,作为工具类)
@author 幸福源于点滴珍惜!
@author 砖尘
@date Mar 18, 2014 8:55:18 PM
/
public class BufferedDemo {
private String path;
private BufferedReader bfr;
private int count;
public BufferedDemo(String path) throws FileNotFoundException {
thispath = path;
bfr = new BufferedReader(new FileReader(path));
}
public int getNullLine() throws IOException {// 获得空行
String len = "";
while ((len = bfrreadLine()) != null) {
if (lenequals(""))
count++;
}
return count;
}
public int getNotesLine() throws IOException {// 获取注释行,这边仅认为//
// 和//是注释。
String len = "";
while ((len = bfrreadLine()) != null) {
if (lencontains("/")) {
if (lencontains("/"))
count++;
else {
count += 2;
while (!(len = bfrreadLine())contains("/"))
count++;
}
}
}
return count;
}
}
工具类中没有写主函数,要运行需要增加主函数。
遍历 d 盘,读取出所有D盘中的文件,并将每个文件的完整路劲一一列出来:
import javaio ;
public class IODemo06
{
public static void main(String args[])
{
loop("d:\\") ; //给出需要遍历的文件名
}
public static void loop(String dir)
{
File f = new File(dir) ;//创建一个文件,如果存在则打开,不存在则新建,这里是打开
String str[] = null ;//用于存放这个路劲下的所有其他文件
if(fisDirectory()) //判断是否是根目录,即如果是文件夹,则执行if语句,否则执行else语句
{
str = flist() ;//获取这个路劲下的所有其他文件
for(int i=0;i<strlength;i++) {
loop(dir+"\\"+str[i]) ;//循环遍历每一个路劲,递归调用
}
}
else
{
Systemoutprintln(dir) ;//将不为根文件的所有文件的路劲名输出来
}
}
};
6
B b=new B();//构建类B的一个对象,指定b为其引用
bf(35) 该方法参数属性为int,所以调用的是类B 的f方法值为 xy=15
bf(30,50)该方法参数属性为double,所以调用的是类A 的f方法值为 x+y=8
7类B中方法f 覆盖父类的方法,其对象只会调用它自己的方法,super调用父类的方法f
答案自己算
你说的应该是生成javadoc吧
最简单方式就是使用命令行, cd到你的项目源代码目录下, 输入如下指令:
javadoc -d docs -subpackages comyourpackage其中-d docs指定了生成的javadoc在相对目录docs下, -subpackages comyourpackage指定了你要被生成javadoc的源代码包
JAVADOC是官方提供的一种生成注释文档的工具, 他的用法如下:
用法: javadoc [options] [packagenames] [sourcefiles] [@files]-overview <file> 从 HTML 文件读取概览文档
-public 仅显示 public 类和成员
-protected 显示 protected/public 类和成员 (默认值)
-package 显示 package/protected/public 类和成员
-private 显示所有类和成员
-help 显示命令行选项并退出
-doclet <class> 通过替代 doclet 生成输出
-docletpath <path> 指定查找 doclet 类文件的位置
-sourcepath <pathlist> 指定查找源文件的位置
-classpath <pathlist> 指定查找用户类文件的位置
-cp <pathlist> 指定查找用户类文件的位置
-exclude <pkglist> 指定要排除的程序包列表
-subpackages <subpkglist> 指定要递归加载的子程序包
-breakiterator 计算带有 BreakIterator 的第一个语句
-bootclasspath <pathlist> 覆盖由引导类加载器所加载的
类文件的位置
-source <release> 提供与指定发行版的源兼容性
-extdirs <dirlist> 覆盖所安装扩展的位置
-verbose 输出有关 Javadoc 正在执行的 *** 作的信息
-locale <name> 要使用的区域设置, 例如 en_US 或 en_US_WIN
-encoding <name> 源文件编码名称
-quiet 不显示状态消息
-J<flag> 直接将 <flag> 传递到运行时系统
-X 输出非标准选项的提要
通过标准 doclet 提供:
-d <directory> 输出文件的目标目录
-use 创建类和程序包用法页面
-version 包含 @version 段
-author 包含 @author 段
-docfilessubdirs 递归复制文档文件子目录
-splitindex 将索引分为每个字母对应一个文件
-windowtitle <text> 文档的浏览器窗口标题
-doctitle <html-code> 包含概览页面的标题
-header <html-code> 包含每个页面的页眉文本
-footer <html-code> 包含每个页面的页脚文本
-top <html-code> 包含每个页面的顶部文本
-bottom <html-code> 包含每个页面的底部文本
-link <url> 创建指向位于 <url> 的 javadoc 输出的链接
-linkoffline <url> <url2> 利用位于 <url2> 的程序包列表链接至位于 <url> 的文档
-excludedocfilessubdir <name1>: 排除具有给定名称的所有文档文件子目录。
-group <name> <p1>:<p2> 在概览页面中, 将指定的程序包分组
-nocomment 不生成说明和标记, 只生成声明。
-nodeprecated 不包含 @deprecated 信息
-noqualifier <name1>:<name2>: 输出中不包括指定限定符的列表。
-nosince 不包含 @since 信息
-notimestamp 不包含隐藏时间戳
-nodeprecatedlist 不生成已过时的列表
-notree 不生成类分层结构
-noindex 不生成索引
-nohelp 不生成帮助链接
-nonavbar 不生成导航栏
-serialwarn 生成有关 @serial 标记的警告
-tag <name>:<locations>:<header> 指定单个参数定制标记
-taglet 要注册的 Taglet 的全限定名称
-tagletpath Taglet 的路径
-charset <charset> 用于跨平台查看生成的文档的字符集。
-helpfile <file> 包含帮助链接所链接到的文件
-linksource 以 HTML 格式生成源文件
-sourcetab <tab length> 指定源中每个制表符占据的空格数
-keywords 使程序包, 类和成员信息附带 HTML 元标记
-stylesheetfile <path> 用于更改生成文档的样式的文件
-docencoding <name> 指定输出的字符编码
以上就是关于求以下Java代码所有行的注释全部的内容,包括:求以下Java代码所有行的注释、求一个JAVA文件里面的代码行空行和注释行、java 程序,望懂的人给个详细点的注释 谢谢了等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)