欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

java顯示代碼行數(shù) java代碼運行結果怎么顯示

java eclipse如何顯示行數(shù)

問題1:在編輯區(qū)最左邊地方右鍵,選擇“Show Line Numbers”就行了。

在遼陽等地區(qū),都構建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產品創(chuàng)新能力,以專注、極致的服務理念,為客戶提供成都做網(wǎng)站、網(wǎng)站設計、外貿營銷網(wǎng)站建設 網(wǎng)站設計制作定制開發(fā),公司網(wǎng)站建設,企業(yè)網(wǎng)站建設,成都品牌網(wǎng)站建設,成都營銷網(wǎng)站建設,外貿營銷網(wǎng)站建設,遼陽網(wǎng)站建設費用合理。

問題2:快捷鍵(ctrl+f)

問題3:在工程名上右鍵,選擇“Refactor-Rename”。

希望對你有幫助!

一個java類標準代碼行數(shù)范圍大概是多少?

以1000行為準,超過千行就要考慮類拆分了。類的代碼行數(shù)沒有特定的行數(shù)限制規(guī)范。根據(jù)實際情況決定。對于經常使用的java類,代碼行數(shù)應該盡可能的少,這樣能減少java類的加載時間,減少內存頻繁占用和回收。如果類過大,java類加載會耗時并且占用內存大。容易引起內存回收。

Java是一種簡單的,面向對象的,分布式的,解釋型的,健壯安全的,結構中立的,可移植的,性能優(yōu)異、多線程的動態(tài)語言。

Java語言其實最早誕生于1991年,起初被稱為OAK語言,是SUN公司為一些消費性電子產品而設計的一個通用環(huán)境。他們最初的目的只是為了開發(fā)一種獨立于平臺的軟件技術,而且在網(wǎng)絡出現(xiàn)之前,OAK可以說是默默無聞,甚至差點夭折。但是,網(wǎng)絡的出現(xiàn)改變了OAK的命運。

如何計算一個.java文件的代碼行數(shù)

方法一:

如果想要通過java代碼的方式來計算.java文件的行數(shù),可以通過IO來讀取,

BufferedReader的方法readLine()來按行讀取,每讀取一行,行數(shù)+1

方法二:

如果要查看.java文件的代碼行數(shù),

可以使用現(xiàn)成的IDE工具,比如ECLIPSE...

每一行的行號都有表示出來

Java 有什么好的代碼行數(shù),注釋行數(shù)統(tǒng)計工具

package com.syl.demo.test;

import java.io.*;

/**

* java代碼行數(shù)統(tǒng)計工具類

* Created by 孫義朗 on 2017/11/17 0017.

*/

public class CountCodeLineUtil {

private static int normalLines = 0; //有效程序行數(shù)

private static int whiteLines = 0; //空白行數(shù)

private static int commentLines = 0; //注釋行數(shù)

public static void countCodeLine(File file) {

System.out.println("代碼行數(shù)統(tǒng)計:" + 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文件統(tǒng)計:" +

"總有效代碼行數(shù): " + normalLines +

" ,總空白行數(shù):" + whiteLines +

" ,總注釋行數(shù):" + commentLines +

" ,總行數(shù):" + (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("http://")) {

// 單行注釋行

commentLines++;

temp_commentLines++;

} else {

// 正常代碼行

normalLines++;

temp_normalLines++;

}

}

System.out.println(file.getName() +

" ,有效行數(shù)" + temp_normalLines +

" ,空白行數(shù)" + temp_whiteLines +

" ,注釋行數(shù)" + temp_commentLines +

" ,總行數(shù)" + (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顯示代碼行數(shù) java代碼運行結果怎么顯示
分享URL:http://chinadenli.net/article26/dojggjg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器品牌網(wǎng)站制作服務器托管商城網(wǎng)站做網(wǎng)站網(wǎng)站改版

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化