導航:首頁 > 源碼編譯 > java清單源碼

java清單源碼

發布時間:2023-06-08 18:39:37

㈠ 如何查看javaJDK中底層源碼

在初次使用java時,往往我們對最基本的java類會忽略對其內部基本的實現的了解,也往往不屑於了解其內部實現機制,以為它們本來就是這樣子。而其實貫穿java的整個過程,所有上層的使用,都是源於對底層的擴展,所以要真正去了解這門語言,就必須得從其底層開始認真去了解它。而要深入了解,就需要更多去關注其內部的實現是怎樣子的。

在使用IDE的過程中,我們經常會需要能在IDE中就可以便捷的去查看java的源碼,但若沒有做相關設置,一般在IDE是查看不了java源碼的,此次提供在eclipse中設置查看java源碼的方式。

設置步驟如下:


1.點 「window」-> "Preferences" -> "Java" -> "Installed JRES"


2.此時"Installed JRES"右邊是列表窗格,列出了系統中的 JRE 環境,選擇你的JRE,然後點邊上的 "Edit...", 會出現一個窗口(Edit JRE)


3.選中rt.jar文件的這一項:「c:program filesjavajre_1.8lib t.jar」
點 左邊的「+」 號展開它,


4.展開後,可以看到「Source Attachment:(none)」,點這一項,點右邊的按鈕「Source Attachment...」, 選擇你的JDK目錄下的 「src.zip」文件(該文件在JDK安裝目錄的根目錄下)


5.一路點"ok",設置完成


設置完成後,按住ctrl鍵再用滑鼠單擊某一個jdk方法名或類名,便能看到該方法的源代碼了。此外按F3也能實現。

PS:rt.jar包含了jdk的基礎類庫,也就是你在java

doc裡面看到的所有的類的class文件;src.zip文件裡面放著的正是基本類所對應的源文件(即*.java格式的文件);同理,我們可以去網上下載各個JAVA開源框架所對應的源代碼包,比如spring-src.zip,然後再按照上面的設置步驟設置,就可以查看到對應的JAVA框架源代碼了。

轉自:網頁鏈接

㈡ JAVA源代碼怎麼看

如何看JAVA源代碼的問題!!

我最近剛剛轉為JAVA開發,因為以前一直做DELPHI,剛一接觸JAVA,感覺好不適應,公司給了一個業務的源代碼學習,可是東一個介面西一個繼承看的我頭好大,各位有什麼好方法可以看的明白些呢,謝謝各位了!!!

畫成UML圖,

導成UML圖~~

用集成環境的編輯工具:JB,eclipse,IntelliJ IDEA等.

如何導出成UML???
用什麼工具導出???

JBuilder 有這個功能
但是還是建議自己來,先畫類的繼承關系,然後是類之間的通信.
了解了整體關系以後,>>再看具體代碼的實現.......

先了解什麼叫 面向對象

先從整體(框架)上了解你所看的東東
然後建立面向對象概念
然後。。。。。。。。
TOGETHER 和ROSE可以導。

沒辦法!
只能從基礎來!
總結樓上的一些建議:
1、了解基本java語法;
2、面向對象思想;
3、最好了解UML語言;
4、稍稍熟悉一種IDE的使用方法。
第二點是最基本的,難以想像在不熟悉面向對象的基礎上能夠真正了解一個java程序的整體結構

推薦使用 Source Insight,看源碼這個是最佳選擇!十分方便!我現在就在用,哈哈

先打好基礎吧
比較你不是從C++轉過來的

㈢ 求JAVA源代碼

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class GradeStatistic {

public static void main(String[] args) {

GradeStatistic gs = new GradeStatistic();

List<Mark> list = new ArrayList<Mark>();

float sum = 0;

while(true){

Scanner sc = new Scanner(System.in);

System.out.print("Please input student name: ");
String name = sc.nextLine();

if(name.equals("end")){
break;
}

System.out.print("Please input student score: ");
float score = sc.nextFloat();
sum += score;

list.add(gs.new Mark(name, score));

}

float max = list.get(0).getScore();
float min = list.get(0).getScore();

for(Mark mark: list){
if(max < mark.getScore()){
max = mark.getScore();
}

if(min > mark.getScore()){
min = mark.getScore();
}

}

float average = sum / list.size();

System.out.println("Average is: " + average);
System.out.println("Max is: " + max);
System.out.println("Min is: " + min);
}

private class Mark{
private String name;
private float score;

public Mark(String name, float score){
this.name = name;
this.score = score;
}
public String getName() {
return name;
}
public float getScore() {
return score;
}
}
}
----------------------
Please input student name: Zhang san
Please input student score: 100
Please input student name: Li Si
Please input student score: 91
Please input student name: Ec
Please input student score: 35
Please input student name: ma qi
Please input student score: 67
Please input student name: end
Average is: 73.25
Max is: 100.0
Min is: 35.0

㈣ 求JAVA源代碼 ~~~~!!!!!!

我給你一個計算器的源代碼,這個好講。自己前幾天寫的,已經被網路收錄了。
import java.awt.Button; import java.awt.Color; import java.awt.Frame; import java.awt.GridLayout; import java.awt.Panel; import java.awt.TextField; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class Calculator extends WindowAdapter implements MouseListener { private String first; private String second; private String operator; private Button zero = new Button("0"); private Button one = new Button("1"); private Button two = new Button("2"); private Button three = new Button("3"); private Button four = new Button("4"謹升); private Button five = new Button("5"); private Button six = new Button("6"); private Button seven = new Button("7"); private Button eight = new Button("8"); private Button nine = new Button("9"); private Button decimal = new Button("."); private Button equal = new Button("="); private Button add = new Button("+"); private Button sub = new Button("-"); private Button mul = new Button("*"); private Button div = new Button("/"); private TextField input = new TextField(); private Button CE = new Button("CE"); private Button DEL = new Button("Del"); 旦晌旦public static void main(String[] args) { new Calculator(); } public Calculator(){ Frame f = new Frame("Calculator"); f.add("North", input); Panel keys = new Panel(); f.add(keys, "Center"); keys.setLayout(new GridLayout(4, 4)); keys.add(seven); keys.add(eight); keys.add(nine); keys.add(add); keys.add(four); keys.add(five); keys.add(six); keys.add(sub); keys.add(one); keys.add(two); keys.add(three); keys.add(mul); keys.add(zero); 模擾keys.add(decimal); keys.add(equal); keys.add(div); zero.addMouseListener(this); one.addMouseListener(this); two.addMouseListener(this); three.addMouseListener(this); four.addMouseListener(this); five.addMouseListener(this); six.addMouseListener(this); seven.addMouseListener(this); eight.addMouseListener(this); nine.addMouseListener(this); add.addMouseListener(this); sub.addMouseListener(this); div.addMouseListener(this); mul.addMouseListener(this); equal.addMouseListener(this); decimal.addMouseListener(this); Panel addtionalPanel = new Panel(); addtionalPanel.setLayout(new GridLayout(1, 2)); addtionalPanel.add(CE); addtionalPanel.add(DEL); CE.setBackground(Color.green); DEL.setBackground(Color.cyan); CE.addMouseListener(this); DEL.addMouseListener(this); f.add("South", addtionalPanel); f.addWindowListener(this); f.setVisible(true); f.setLocation(200, 300); f.setSize(200, 200); } public void windowClosing(WindowEvent e) { System.exit(0); } public void mouseClicked(MouseEvent e) { Button btn = (Button) e.getSource(); String key = btn.getActionCommand().trim(); if(btn == one || btn == two || btn == three || btn == zero || btn == four || btn == five || btn == six || btn == seven || btn == eight || btn == nine){ if(isBlank(operator)){ if(isBlank(first)){ first = key; }else{ first += key; } input.setText(first); }else{ if(isBlank(second)){ second = key; }else{ second += key; } input.setText(second); } }else if(btn == decimal){ if(isBlank(operator)){ if(isBlank(first)){ first = "0."; input.setText(first); }else{ if(first.indexOf(".") == -1){ first += "."; input.setText(first); } } }else{ if(isBlank(second)){ second = "0."; input.setText(second); }else{ if(second.indexOf(".") == -1){ second += "."; input.setText(second); } } } }else if(btn == equal){ if(!isBlank(second) && !isBlank(first) && !isBlank(operator)){ double result = 0.0D; if(operator.equals("+")){ result = Double.parseDouble(first) + Double.parseDouble(second); }else if(operator.equals("-")){ result = Double.parseDouble(first) - Double.parseDouble(second); }else if(operator.equals("*")){ result = Double.parseDouble(first) * Double.parseDouble(second); }else if(operator.equals("/")){ result = Double.parseDouble(first) / Double.parseDouble(second); } int value = (int)Math.round(result); if(value == result){ input.setText(String.valueOf(value)); }else{ input.setText(String.valueOf(result)); } first = String.valueOf(result); second = null; operator = null; } }else if(btn == add || btn == sub || btn == div || btn == mul){ if(!isBlank(first)){ if(!isBlank(operator) && !isBlank(second)){ if(operator.equals("+")){ first = String.valueOf(Double.parseDouble(first) + Double.parseDouble(second)); }else if(operator.equals("-")){ first = String.valueOf(Double.parseDouble(first) - Double.parseDouble(second)); }else if(operator.equals("*")){ first = String.valueOf(Double.parseDouble(first) * Double.parseDouble(second)); }else if(operator.equals("/")){ first = String.valueOf(Double.parseDouble(first) / Double.parseDouble(second)); } second = null; } operator = key; } }else if(btn == CE){ first = null; second = null; operator = null; input.setText(null); }else if(btn == DEL){ if(isBlank(operator)){ if(!isBlank(first)){ first = first.substring(0, first.length() -1); input.setText(first); } }else{ if(!isBlank(second)){ second = second.substring(0, second.length() -1); input.setText(second); } } } } private boolean isBlank(String str){ return str == null || str.trim().equals(""); } public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }

㈤ 我想看一點簡單的Java程序的源代碼

兄弟可以聯系 hi留言也行
我這里保留了,從學習java第一天起到現在 學習練習代碼,
基礎部分注釋很詳細。

//每一位相加求和
public class Demo
{
public static void main(String[] args)
{
int i = 45678;
int sum = 0;
int c = 0;
for(int j = 4; j >= 0; j--)
{
int b = (int) Math.pow(10, j);
c = i / b;

System.out.println(c);

sum += c;
System.out.println("sum=" + sum);

i %= b;
}
System.out.println(sum);
}
}

public class ZY1030
{
public static void main(String[] asgs)
{
zy1();
zy2();
zy3();
zy4();
zy5();
zy6();
zy7();
yanghuisanjiao();

}

public static void yanghuisanjiao()
{
int[][] pas = new int[6][];
for(int i = 0; i < pas.length; i++)
{
pas[i] = new int[i + 1];
pas[i][0] = 1;
pas[i][i] = 1;
for(int j = 0; j < pas[i].length - 1; j++)
{
if(j >= 1 && i > 1)
pas[i][j] = pas[i - 1][j - 1] + pas[i - 1][j];
}
}
for(int i = 0; i < pas.length; i++)
{
for(int j = 0; j < pas[i].length; j++)
{
System.out.print(pas[i][j]);
System.out.println();
}
}
System.out.println();
}

private static void zy1()
{
System.out.println("��ҵ1");
/*

*
**
***
****
*****
******
*******

*/
for(int r = 0; r < 7; r++)
{
for(int j = 0; j < r + 1; j++)
{
System.out.print("*");
}
System.out.println();
}
}

private static void zy2()
{
System.out.println("\n��ҵ2");
/*
*
***
*****
*******
*********
*/
for(int r = 0; r <= 5; r++)
{

for(int j = 0; j < 11 - r; j++)
{
System.out.print(" ");
}

for(int j = 0; j < r * 2 + 1; j++)
{
System.out.print("*");
}
System.out.println();
}
}

private static void zy3()
{
System.out.println("\n��ҵ3");
/*
*
* *
* * *
* * * *
* * * * *
*/
for(int r = 0; r <= 5; r++)
{

for(int j = 0; j < 10 - r; j++)
{
System.out.print(" ");
}

for(int j = 0; j < r; j++)
{
System.out.print("* ");
}
System.out.println();
}
}

private static void zy4()
{
System.out.println("\n��ҵ4");
/*
***********
***********
***********
***********
***********
*/
for(int r = 0; r <= 5; r++)
{

for(int j = 0; j < 7 - r; j++)
{
System.out.print(" ");
}

for(int j = 0; j < 10; j++)
{
System.out.print("*");
}
System.out.println();
}
}

private static void zy5()
{
System.out.println("\n��ҵ5");
/*
1X1=1
1X2=2 2X2=4
1X3=3 2X3=6 3X3=9
....
*/
for(int r = 1; r <= 9; r++)
{

for(int j = 1; j <= r; j++)
{
int iValue = j * r; //����ֵ
String str = j + "X" + r + "=" + iValue + " ";

System.out.print(str);
//System.out.print(" J:" + j);
}

System.out.println();
//System.out.println("R:" + r);
}
}

private static void zy6()
{
System.out.println("\n��ҵ6");
/*
������(����) ֻ�ܱ�1�ͱ����������������
3 5 7 11 13 17 19 23 ....

int n = 4;
boolean t = true; // assume is SU_SHU
for(int i=2; i<n; i++)
{
if(n%i==0)
{
t = false;
break;
}
}
System.out.println(t);
*/
for(int i = 2; i <= 100; i++)
{

// if(i % 2 ==0 || i % 3 == 0 )
// {
// continue;
// }
// System.out.print(i + " ");

boolean bTrue = true;
for(int j = 2; j < i; j++)
{
if(i % j == 0)
{
bTrue = false;
break;
}
}

if(bTrue)
{
System.out.println(i);
}
}
System.out.println();
}

private static void zy7()
{
System.out.println("\n��ҵ7");
/*
int n = 23623;

int x = n % 100000 / 10000;
System.out.println(x);

x = n % 10000 / 1000;
System.out.println(x);

x = n % 1000 / 100;
System.out.println(x);
*/

}

}

㈥ 什麼是java源代碼 怎麼查看

不知道你說的是瀏覽器的還是什麼的,
如果是瀏覽器的那麼簡單找到工具-查看源代碼,你就能看見代碼了,
還有一個就是被編譯成class文件的java用反編譯工具可以看到源代碼,
如果以上都不是你想要的答案,那麼你所說的代碼就是程序員寫好的代碼文件

㈦ java求源代碼

你是青鳥的吧這我寫過有源碼這里怎麼上傳壓縮包啊

packageghhh;

importjava.util.Scanner;

publicclassDvD{

publicstaticvoidmain(String[]args){

intstate[]=newint[6];
Stringname[]=newString[6];
intdate[]=newint[6];
intcount[]=newint[6];

name[0]="權利的游戲";
name[1]="命運之夜";
name[2]="傲慢與偏見";

state[0]=1;
state[1]=0;
state[2]=1;

date[0]=13;
date[1]=0;
date[2]=9;

count[0]=23;
count[1]=23;
count[2]=23;
intn;
// booleann=false;
do{
System.out.println("歡迎使用迷你DVD管理器");
System.out.println("1.新增DVD");
System.out.println("2.查看DVD");
System.out.println("3.刪除DVD");
System.out.println("4.借出DVD");
System.out.println("5.歸還DVD");
System.out.println("6.退出DVD");
Scannerinput=newScanner(System.in);
System.out.println("請選擇:");
n=input.nextInt();

switch(n){
case1:
System.out.println("請輸入要增加DVD的名稱:");
Stringname1=input.next();
booleanflag=false;
for(inti=0;i<name.length;i++){
if(name[i]==null){
name[i]=name1;
flag=true;
break;
}
}
if(flag){
System.out.println("新增DVD"+name1+"成功");
}else{
System.out.println("貨架已滿!增加失敗!");
}
System.out.println("請輸入0返回!");
n=input.nextInt();
break;

case2:
System.out.println("序號 "+"狀態 "+"名稱 "+"借出日期 "+"借出次數");

for(inti=0;i<name.length;i++){
if(name[i]!=null){
Stringstate1=((state[i]==0)?"可借":"已借");
Stringdate1=((date[i]==0)?"":date[i]+"日");
Stringcount1=count[i]+"次";
System.out.println((i+1)+" "+state1+" "+name[i]+" "+date1+" "+count1);
}
}

System.out.println("請輸入0返回!");
n=input.nextInt();
break;

case3:
System.out.println("請輸入要刪除的DVD名稱:");
Stringname2=input.next();
intindex=-1;
booleana=false;
booleanflag1=false;
for(inti=0;i<name.length;i++){
if(name2.equals(name[i])&&state[i]==1){
System.out.println("此DVD已經借出,無法刪除");
a=true;
break;
}elseif(name2.equals(name[i])&&state[i]==0){
a=true;
index=i;
flag1=true;
System.out.println("刪除成功!");
break;
}
}
if(a==false){
System.out.println("沒有找到相同名稱的DVD!");
}
if(flag1){
for(inti=index;i<name.length;i++){
if(i!=name.length-1){
name[i]=name[i+1];
state[i]=state[i+1];
date[i]=date[i+1];
count[i]=count[i+1];
}
name[name.length-1]=null;
state[name.length-1]=0;
date[name.length-1]=0;
count[name.length-1]=0;
}
}
System.out.println("請輸入0返回!");
n=input.nextInt();
break;

case4:
System.out.println("請輸入要借出的DVD:");
Stringname3=input.next();
booleana3=false;
booleanb3=false;
for(inti=0;i<name.length;i++){
if(name3.equals(name[i])&&state[i]==1){
System.out.println("該DVD已經借出");
a3=true;
}elseif(name3.equals(name[i])&&state[i]==0){
do{
System.out.println("請輸入借出的日期:");
intm=input.nextInt();

if(m>31||m<1){
System.out.println("請重新輸入日期:");
b3=true;
}else{
date[i]=m;
state[i]=1;
count[i]+=1;
}

}while(b3==true);
System.out.println("借出成功!");
a3=true;
}
}
if(a3==false){
System.out.println("沒有該DVD");
}
System.out.println("請輸入0返回!");
n=input.nextInt();
break;

case5:
System.out.println("請輸入要歸還的DVD:");
Stringname5=input.next();
booleanb5=false;
booleanm5=false;
for(inti=0;i<name.length;i++){
if(name5.equals(name[i])&&state[i]==1){
b5=true;
do{
System.out.println("請輸入要歸還DVD的日期:(歸還日期請輸入當月日期1~31)");
inta5=input.nextInt();
if(a5>31){
System.out.println("請重新輸入日期:");
m5=true;

}elseif(a5<date[i]){
System.out.println("借出日期是"+date[i]+"日 輸入的日期不能小於借出的日期,請重新輸入日期:");
m5=true;
}else{
state[i]=0;
System.out.println("歸還成功");
System.out.println("借出日期是:"+date[i]+"歸還日期是:"+a5+"日 租金一天一元:共"+(a5-date[i])+"元");
date[i]=0;
m5=false;
}

}while(m5==true);


}elseif(name5.equals(name[i])&&state[i]==0){
System.out.println("該DVD未借出,不可歸還!");
b5=true;
}
}

if(b5==false){
System.out.println("沒有該名稱的DVDV");
}

System.out.println("請輸入0返回!");
n=input.nextInt();
break;

case6:
n=1;
System.out.println("程序退出!");
break;

default:
if(n==0){
}else{
System.out.println("輸入錯誤!請重新輸入!");
n=0;
}
break;

}


}while(n==0);

System.out.println("謝謝使用!");
}

}

看看有沒有問題 好久之前的了

閱讀全文

與java清單源碼相關的資料

熱點內容
怎麼查找雲伺服器上的ftp 瀏覽:156
我的世界伺服器如何注冊賬號 瀏覽:934
統計英文字元python 瀏覽:423
linux信息安全 瀏覽:908
壓縮機接線柱爆 瀏覽:999
程序員自主創業 瀏覽:584
匯編程序員待遇 瀏覽:359
怎麼批量有順序的命名文件夾 瀏覽:211
杭州程序員健身 瀏覽:19
dvd光碟存儲漢子演算法 瀏覽:758
蘋果郵件無法連接伺服器地址 瀏覽:963
phpffmpeg轉碼 瀏覽:672
長沙好玩的解壓項目 瀏覽:145
專屬學情分析報告是什麼app 瀏覽:564
php工程部署 瀏覽:833
android全屏透明 瀏覽:737
阿里雲伺服器已開通怎麼辦 瀏覽:803
光遇為什麼登錄時伺服器已滿 瀏覽:302
PDF分析 瀏覽:486
h3c光纖全工半全工設置命令 瀏覽:143