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

java代碼長啥樣,java是什么樣的

什么是java源代碼 怎么查看

你說的java源代碼是指編譯成的class文件前的java文件。

創(chuàng)新互聯(lián)建站-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比驛城網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式驛城網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋驛城地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。

當(dāng)我們運(yùn)行.java文件時(shí),它會(huì)被系統(tǒng)編譯成.class文件,例如Test.java編譯之后就是Test.class,

源文件就是指Test.java文件,

一般部署項(xiàng)目時(shí),有.class文件就可以發(fā)布運(yùn)行了,但是如果想修改這個(gè)系統(tǒng),.class是不能修改的,要有.java文件才能修改

也可以上網(wǎng)去下反編譯軟件,就是能把.class文件大部分還原成.java文件的工具,但不是100%還原,而且如果不是正版的,小心有毒啊,什么的。

JAVA代碼

public gongnengJF() {

initComponents();

if(MessagePost.getUserPost().equals("職工")){

this.jMenuItem2.setEnabled(false);

里面initComponents什么意思setEnabled是什么?

/*

initComponents()

是你在使用GUI工具設(shè)計(jì)GUI界面時(shí),NetBeans系統(tǒng)自動(dòng)生成的方法。其功能是在界面添加各個(gè)組件,并為它們注冊監(jiān)聽器。把initComponents()放在構(gòu)造方法中,目的在于:在主類調(diào)用構(gòu)造方法初始化時(shí),完成了界面的繪制。

setEnabled(false)

是設(shè)置組件是否可用。

為false時(shí),是不可用。

*/

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new pingcebumen().setVisible(true);

this.setVisible(false);

}

private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

String newpwd=javax.swing.JOptionPane.showInputDialog(rootPane, "輸入新密碼");

String sql="update renyuanlist password ="+newpwd+"where username ='"+MessagePost.getUserName()+"'";

Database db = new Database();

db.executeDML(sql);

}

private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new ziliao().setVisible(true);

String newpwd = null;

String sql="select * from renyuanlist where password ="+newpwd+"where username ='"+MessagePost.getUserName()+"'";

}

private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

new ziliao().setVisible(true);

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

MessagePost.setUserPost("職工");

new gongnengJF().setVisible(true);

}

});

}

// Variables declaration - do not modify

//私有的成員屬性,定義GUI圖形界面的按鈕,菜單等。

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JMenu jMenu1;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JMenuItem jMenuItem1;

private javax.swing.JMenuItem jMenuItem2;

private javax.swing.JMenuItem jMenuItem3;

private javax.swing.JMenuItem jMenuItem4;

Swing是一組Java程序元件,它能夠創(chuàng)建圖象用戶接口(GUI)元件,如按鈕和滾動(dòng)條,它們獨(dú)立于特定操作系統(tǒng)的開窗口系統(tǒng)。Swing元件使用Java Foundation Classes(JFC)。

new gongnengJF().setVisible(true);

this.setVisible(false);

通過new 創(chuàng)建的對(duì)象,與this不是同一個(gè)對(duì)象。

鼠標(biāo)監(jiān)聽事件,包括單擊,雙擊等。。。

什么是JAVA的代碼?

java代碼就是一種軟件的程序,就想殺毒軟件一樣,靠數(shù)據(jù)來運(yùn)行。

簡單記事本的java程序代碼

天啊,?冖_Na0?為什么會(huì)有我編的記事本代碼呢???呵呵……你肯定是“請(qǐng)教”過我的吧??

呵呵……我自己編了一個(gè),不過呢,沒有windows那么多的功能啊。

涉及到兩個(gè)文件:

第一個(gè)文件中的代碼:

package?MyProject;

import?java.awt.BorderLayout;

import?javax.swing.JPanel;

import?javax.swing.JFrame;

import?java.awt.Dimension;

import?javax.swing.JMenuBar;

import?javax.swing.JMenu;

import?javax.swing.JMenuItem;

import?javax.swing.JLabel;

import?java.awt.Rectangle;

import?javax.swing.JTextArea;

import?javax.swing.JScrollPane;

import?java.awt.datatransfer.*;

import?java.io.*;

public?class?MainFrame?extends?JFrame?{

private?static?final?long?serialVersionUID?=?1L;

private?JPanel?jContentPane?=?null;

private?JMenuBar?jJMenuBar?=?null;

private?JMenu?jMenu?=?null;

private?JMenu?jMenu1?=?null;

private?JMenu?jMenu2?=?null;

private?JMenuItem?jMenuItem?=?null;

private?JMenuItem?jMenuItem1?=?null;

private?JMenuItem?jMenuItem2?=?null;

private?JMenuItem?jMenuItem3?=?null;

private?JLabel?jLabel?=?null;

private?JScrollPane?jScrollPane?=?null;

private?JTextArea?jTextArea?=?null;

private?JMenuItem?jMenuItem4?=?null;

private?JMenuItem?jMenuItem5?=?null;

private?JMenuItem?jMenuItem6?=?null;

private?JMenuItem?jMenuItem7?=?null;

private?static?MainFrame?myMainFrame=null;

private?static?String?textstr="";///用于記錄文本文件的路徑

private?File?myFile=null;

private?FileReader?myrder=null;

private?FileWriter?mywr=null;

/**

*?This?is?the?default?constructor

*/

public?MainFrame()?{

super();

initialize();

}

/**

*?This?method?initializes?this

*

*?@return?void

*/

private?void?initialize()?{

this.setSize(412,?350);

this.setJMenuBar(getJJMenuBar());

this.setContentPane(getJContentPane());

this.setTitle("JFrame");

this.addWindowListener(new?java.awt.event.WindowAdapter()?{

public?void?windowActivated(java.awt.event.WindowEvent?e)?{

if(!textstr.equals("")){

try{

myFile=new?File(textstr);

if(!myFile.exists()){

myFile.createNewFile();

}

myrder=new?FileReader(myFile);

char[]?mychar=new?char[(int)myFile.length()];

myrder.read(mychar);

String?tmp=new?String(mychar);

jTextArea.setText(tmp);

myrder.close();

}

catch(Exception?ee){

ee.printStackTrace();

}

}

}

public?void?windowClosing(java.awt.event.WindowEvent?e)?{

System.exit(0);

}

});

this.setVisible(true);

myMainFrame=this;

}

/**

*?This?method?initializes?jContentPane

*

*?@return?javax.swing.JPanel

*/

private?JPanel?getJContentPane()?{

if?(jContentPane?==?null)?{

jLabel?=?new?JLabel();

jLabel.setBounds(new?Rectangle(15,?18,?65,?18));

jLabel.setText("文件內(nèi)容:");

jContentPane?=?new?JPanel();

jContentPane.setLayout(null);

jContentPane.add(jLabel,?null);

jContentPane.add(getJScrollPane(),?null);

}

return?jContentPane;

}

/**

*?This?method?initializes?jJMenuBar

*

*?@return?javax.swing.JMenuBar

*/

private?JMenuBar?getJJMenuBar()?{

if?(jJMenuBar?==?null)?{

jJMenuBar?=?new?JMenuBar();

jJMenuBar.add(getJMenu());

jJMenuBar.add(getJMenu1());

jJMenuBar.add(getJMenu2());

}

return?jJMenuBar;

}

/**

*?This?method?initializes?jMenu

*

*?@return?javax.swing.JMenu

*/

private?JMenu?getJMenu()?{

if?(jMenu?==?null)?{

jMenu?=?new?JMenu();

jMenu.setText("文件");

jMenu.add(getJMenuItem());

jMenu.add(getJMenuItem1());

jMenu.add(getJMenuItem2());

jMenu.add(getJMenuItem3());

}

return?jMenu;

}

/**

*?This?method?initializes?jMenu1

*

*?@return?javax.swing.JMenu

*/

private?JMenu?getJMenu1()?{

if?(jMenu1?==?null)?{

jMenu1?=?new?JMenu();

jMenu1.setText("編輯");

jMenu1.add(getJMenuItem4());

jMenu1.add(getJMenuItem5());

jMenu1.add(getJMenuItem6());

}

return?jMenu1;

}

/**

*?This?method?initializes?jMenu2

*

*?@return?javax.swing.JMenu

*/

private?JMenu?getJMenu2()?{

if?(jMenu2?==?null)?{

jMenu2?=?new?JMenu();

jMenu2.setText("幫助");

jMenu2.add(getJMenuItem7());

}

return?jMenu2;

}

/**

*?This?method?initializes?jMenuItem

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem()?{

if?(jMenuItem?==?null)?{

jMenuItem?=?new?JMenuItem();

jMenuItem.setText("打開");

jMenuItem.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

MainFrame.this.myMainFrame.setEnabled(false);

SelectTextFile?mysl=new?SelectTextFile();

mysl.setVisible(true);

}

});

}

return?jMenuItem;

}

/**

*?This?method?initializes?jMenuItem1

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem1()?{

if?(jMenuItem1?==?null)?{

jMenuItem1?=?new?JMenuItem();

jMenuItem1.setText("關(guān)閉");

jMenuItem1.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

try{

myFile=null;

}

catch(Exception?ee){

ee.printStackTrace();

}

jTextArea.setText("");

}

});

}

return?jMenuItem1;

}

/**

*?This?method?initializes?jMenuItem2

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem2()?{

if?(jMenuItem2?==?null)?{

jMenuItem2?=?new?JMenuItem();

jMenuItem2.setText("保存");

jMenuItem2.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

try{

String?tmp=jTextArea.getText();

char[]?mychar=tmp.toCharArray();

myFile.delete();

myFile.createNewFile();

mywr=new?FileWriter(myFile);

mywr.write(mychar);

mywr.close();

}

catch(Exception?ee){

ee.printStackTrace();

}

}

});

}

return?jMenuItem2;

}

/**

*?This?method?initializes?jMenuItem3

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem3()?{

if?(jMenuItem3?==?null)?{

jMenuItem3?=?new?JMenuItem();

jMenuItem3.setText("退出");

jMenuItem3.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

System.exit(0);

}

});

}

return?jMenuItem3;

}

/**

*?This?method?initializes?jScrollPane

*

*?@return?javax.swing.JScrollPane

*/

private?JScrollPane?getJScrollPane()?{

if?(jScrollPane?==?null)?{

jScrollPane?=?new?JScrollPane();

jScrollPane.setBounds(new?Rectangle(15,?46,?371,?225));

jScrollPane.setViewportView(getJTextArea());

}

return?jScrollPane;

}

/**

*?This?method?initializes?jTextArea

*

*?@return?javax.swing.JTextArea

*/

private?JTextArea?getJTextArea()?{

if?(jTextArea?==?null)?{

jTextArea?=?new?JTextArea();

}

return?jTextArea;

}

/**

*?This?method?initializes?jMenuItem4

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem4()?{

if?(jMenuItem4?==?null)?{

jMenuItem4?=?new?JMenuItem();

jMenuItem4.setText("復(fù)制");

jMenuItem4.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

MainFrame.this.setClipboardText(MainFrame.this.getToolkit().getSystemClipboard(),jTextArea.getSelectedText());

}

});

}

return?jMenuItem4;

}

/**

*?This?method?initializes?jMenuItem5

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem5()?{

if?(jMenuItem5?==?null)?{

jMenuItem5?=?new?JMenuItem();

jMenuItem5.setText("剪切");

jMenuItem5.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

MainFrame.this.setClipboardText(MainFrame.this.getToolkit().getSystemClipboard(),jTextArea.getSelectedText());

jTextArea.setText(jTextArea.getText().substring(0,jTextArea.getSelectionStart()));

}

});

}

return?jMenuItem5;

}

/**

*?This?method?initializes?jMenuItem6

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem6()?{

if?(jMenuItem6?==?null)?{

jMenuItem6?=?new?JMenuItem();

jMenuItem6.setText("黏貼");

jMenuItem6.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

try{

jTextArea.setText(jTextArea.getText().substring(0,jTextArea.getSelectionStart()));

jTextArea.setText(jTextArea.getText()+(MainFrame.this.getClipboardText(MainFrame.this.getToolkit().getSystemClipboard())));

}

catch(Exception?ee){

ee.printStackTrace();

}

}

});

}

return?jMenuItem6;

}

/**

*?This?method?initializes?jMenuItem7

*

*?@return?javax.swing.JMenuItem

*/

private?JMenuItem?getJMenuItem7()?{

if?(jMenuItem7?==?null)?{

jMenuItem7?=?new?JMenuItem();

jMenuItem7.setText("關(guān)于記事本");

jMenuItem7.addActionListener(new?java.awt.event.ActionListener()?{

public?void?actionPerformed(java.awt.event.ActionEvent?e)?{

////暫無代碼!!

}

});

}

return?jMenuItem7;

}

public?static?void?main(String?args[]){

new?MainFrame();

}

public?static?MainFrame?getMyMainFrame()?{

return?myMainFrame;

}

public?static?void?setMyMainFrame(MainFrame?myMainFrame)?{

MainFrame.myMainFrame?=?myMainFrame;

}

public?static?String?getTextstr()?{

return?textstr;

}

public?static?void?setTextstr(String?textstr)?{

MainFrame.textstr?=?textstr;

}

protected?static?String?getClipboardText(Clipboard?clip)?throws?Exception{

Transferable?clipT?=?clip.getContents(null);//?獲取剪切板中的內(nèi)容

if?(clipT?!=?null)?{

if?(clipT.isDataFlavorSupported(DataFlavor.stringFlavor))?//?檢查內(nèi)容是否是文本類型

return?(String)clipT.getTransferData(DataFlavor.stringFlavor);

}

return?null;

}

protected?static?void?setClipboardText(Clipboard?clip,?String?writeMe)?{

Transferable?tText?=?new?StringSelection(writeMe);

clip.setContents(tText,?null);

}

}??//??@jve:decl-index=0:visual-constraint="10,10"

第二個(gè)文件中的代碼:

(太長了,貼不上來)

整個(gè)效果就是實(shí)現(xiàn)了基本的打開、關(guān)閉、保存、退出的功能。

效果如圖:

Java的基本格式

基本格式:修飾符 class 類名(程序代碼)

意義:Java中的程序代碼都必須放在一個(gè)類中,對(duì)于類初學(xué)者可以簡單地把它理解為一個(gè)java程序;類需要使用class作為關(guān)鍵字定義;而在class的前面可以有一些修飾符。

擴(kuò)展資料

編寫java時(shí),特別需要注意的幾個(gè)書寫格式常見的錯(cuò)誤:

1.java中的程序代碼中功能執(zhí)行語句的最后都必須用(;)結(jié)束。

這里需要注意的是,在程序中不要將英文的分號(hào)(;)誤寫成中文的分號(hào)(;) ,如果寫成了中文的分號(hào),編譯器會(huì)報(bào)告“Invalid character”(無效字符)這樣的錯(cuò)誤信息。

2.Java語言是嚴(yán)格區(qū)分大小寫的。在定義類時(shí),不能將class寫成Class,否則編譯會(huì)報(bào)錯(cuò)。程序中定義一個(gè)computer的同時(shí),還可以定義一個(gè)Computer,computer和Computer是兩個(gè)全完不同的符號(hào),在使用的時(shí)候需要注意。

3. 在編寫java代碼的時(shí)候?yàn)榱吮阌陂喿x,通常會(huì)使用一種良好的格式進(jìn)行排版,但這并不是必須的,我們也可以在兩個(gè)單詞或者符號(hào)之間任意換行。

參考資料:百度百科-java

請(qǐng)問一下java代碼是什么意思,有什么功能呢

這是一個(gè)配置文件吧?

//后面 和 /**/中間 的內(nèi)容都是注釋,你可以把注釋用有道翻譯一下看看,好像是舉的例子

真正的代碼只有三行:

var next = output.append(input[0]);

for (var i = 0; i input.length; i++) {

var next = output.append(input[i]);

大概意思是 將輸入的字符串添加到輸出的字符串中,分兩種情況,第一行是只有一個(gè)輸入字符串時(shí),只追加數(shù)組的第一個(gè)元素;下面兩行的for循環(huán)是對(duì)多個(gè)輸入字符串的處理方法,用for循環(huán)追加字符串。for循環(huán)你能看懂吧?append是追加字符串的意思,將input添加到output的最后面。

名稱欄目:java代碼長啥樣,java是什么樣的
地址分享:http://chinadenli.net/article44/hdoghe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、網(wǎng)站營銷虛擬主機(jī)、微信小程序自適應(yīng)網(wǎng)站、網(wǎng)站改版

廣告

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

小程序開發(fā)