「java标准行数」java行号
本篇文章给大家谈谈java标准行数,以及java行号对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
- 1、java 项目 代码行数多少 算大项目
- 2、java中设置编辑框的行数用什么函数
- 3、Java 有什么好的代码行数,注释行数统计工具
- 4、对日java项目开发来说,一个月平均能编写多少行代码,正常来说的标准是多少行代码?
- 5、在JAVA中怎样求二维数组的行数和列数?
- 6、一个java类标准代码行数范围大概是多少
java 项目 代码行数多少 算大项目
java项目的大小衡量标准:
微型:只是一个人,甚至是半日工作在几天内完成的软件;
小型:一个人半年内完成的 2000 行以内的程序;
中型: 5 个人在 1 年多的时间内完成的 5000-50000 行的程序;
大型: 5-10 人在两年内完成的 50000-100000 行的程序;
甚大型: 100-1000 人参加用 4-5 年完成的具有 100 , 0000 行的软件项目;
极大型: 2000-5000 人参加, 10 年内完成的 1000 万行以内的程序;
以上摘自:《软件工程概论》 郑人杰、殷人民编
这样的观点是以代码行作为计量标准的,认为代码行多的自然项目也就大了。
java中设置编辑框的行数用什么函数
javax.swing
Class JTextArea
java.lang.Object
extended by java.awt.Component
extended by java.awt.Container
extended by javax.swing.JComponent
extended by javax.swing.text.JTextComponent
extended by javax.swing.JTextArea
构造函数
JTextArea(String text, int rows, int columns)
Constructs a new TextArea with the specified text and number of rows and columns.
方法
void setRows(int rows)
Sets the number of rows for this TextArea.
Java 有什么好的代码行数,注释行数统计工具
package com.syl.demo.test;
import java.io.*;
/**
* java代码行数统计工具类
* Created by 孙义朗 on 2017/11/17 0017.
*/
public class CountCodeLineUtil {
private static int normalLines = 0; //有效程序行数
private static int whiteLines = 0; //空白行数
private static int commentLines = 0; //注释行数
public static void countCodeLine(File file) {
System.out.println("代码行数统计:" + file.getAbsolutePath());
if (file.exists()) {
try {
scanFile(file);
} catch (IOException e) {
e.printStackTrace();
}
} else {
System.out.println("文件不存在!");
System.exit(0);
}
System.out.println(file.getAbsolutePath() + " ,java文件统计:" +
"总有效代码行数: " + normalLines +
" ,总空白行数:" + whiteLines +
" ,总注释行数:" + commentLines +
" ,总行数:" + (normalLines + whiteLines + commentLines));
}
private static void scanFile(File file) throws IOException {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i files.length; i++) {
scanFile(files[i]);
}
}
if (file.isFile()) {
if (file.getName().endsWith(".java")) {
count(file);
}
}
}
private static void count(File file) {
BufferedReader br = null;
// 判断此行是否为注释行
boolean comment = false;
int temp_whiteLines = 0;
int temp_commentLines = 0;
int temp_normalLines = 0;
try {
br = new BufferedReader(new FileReader(file));
String line = "";
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.matches("^[//s[^//n]]*$")) {
// 空行
whiteLines++;
temp_whiteLines++;
} else if (line.startsWith("/*") !line.endsWith("*/")) {
// 判断此行为"/*"开头的注释行
commentLines++;
comment = true;
} else if (comment == true !line.endsWith("*/")) {
// 为多行注释中的一行(不是开头和结尾)
commentLines++;
temp_commentLines++;
} else if (comment == true line.endsWith("*/")) {
// 为多行注释的结束行
commentLines++;
temp_commentLines++;
comment = false;
} else if (line.startsWith("//")) {
// 单行注释行
commentLines++;
temp_commentLines++;
} else {
// 正常代码行
normalLines++;
temp_normalLines++;
}
}
System.out.println(file.getName() +
" ,有效行数" + temp_normalLines +
" ,空白行数" + temp_whiteLines +
" ,注释行数" + temp_commentLines +
" ,总行数" + (temp_normalLines + temp_whiteLines + temp_commentLines));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
br = null;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//测试
public static void main(String[] args) {
File file = new File("F:\\myweb");
countCodeLine(file);
}
}
对日java项目开发来说,一个月平均能编写多少行代码,正常来说的标准是多少行代码?
在日本早期的软件开发管理中,的确有按照代码行数来算开发成本的,但是,随着目标指向语言流行和软件开发管理的进步,这种方法已经很少见了。
而且,现在很流行开发工具自动化,很多代码都是自动生成的,很难计算一个月能写多少代码。
如果非要数字,平均一个月写3到10万行应该是不成问题的。
有一种叫做StepCounter的工具可以计算java代码行数,lz可以看一下。
在JAVA中怎样求二维数组的行数和列数?
我就说下思路吧。
先求列数:用一个元素去遍历这个数组的第一行(a[0])每次遍历都使变量加一,最后得到列数,,。
行数:用一个一维数组遍历这个二维数组,每次遍历都使变量加一,最后得到行数。
一个java类标准代码行数范围大概是多少
一般情况下类的代码则没有限制,但类中的方法最好一个方法不要超过100行代码,
java标准行数的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java行号、java标准行数的信息别忘了在本站进行查找喔。
发布于:2022-12-12,除非注明,否则均为
原创文章,转载请注明出处。