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

java面試源代碼,csdn java面試

初學(xué)者請求java源代碼

class Car

成都創(chuàng)新互聯(lián)公司一直在為企業(yè)提供服務(wù),多年的磨煉,使我們在創(chuàng)意設(shè)計,全網(wǎng)整合營銷推廣到技術(shù)研發(fā)擁有了開發(fā)經(jīng)驗。我們擅長傾聽企業(yè)需求,挖掘用戶對產(chǎn)品需求服務(wù)價值,為企業(yè)制作有用的創(chuàng)意設(shè)計體驗。核心團(tuán)隊擁有超過10余年以上行業(yè)經(jīng)驗,涵蓋創(chuàng)意,策化,開發(fā)等專業(yè)領(lǐng)域,公司涉及領(lǐng)域有基礎(chǔ)互聯(lián)網(wǎng)服務(wù)溫江服務(wù)器托管重慶APP開發(fā)公司、手機(jī)移動建站、網(wǎng)頁設(shè)計、網(wǎng)絡(luò)整合營銷。

{

// 車輛屬性

private String brand; // 品牌

private double engineDisplacement;// 排氣量

private double speed;// 當(dāng)前速度

private boolean status;// 啟動狀態(tài)

private double maxSpeed;// 最大速度

public double getSpeed () {

return this.speed;

}

public Car(String brand, double engineDisplacement, double maxSpeed) {

this.brand = brand;

this.engineDisplacement = engineDisplacement;

this.maxSpeed = maxSpeed;

// 其他屬性也要有初始值,不然執(zhí)行出錯。

this.speed = 0;

this.status = false;

}

/** 啟動 */

public void start() {

this.status = true;

printNowStatus ();

}

/** 關(guān)閉(熄火) */

public void stop() {

// 只在速度為0時關(guān)閉(貌似樓上兩位沒仔細(xì)看題…)

if (this.speed == 0)

{

this.status = false;

}

printNowStatus ();

}

/** 加速 */

public void speedUp() {

// 只在啟動時可以加速

if (this.status)

{

this.speed = this.speed + 20;

if (this.speed this.maxSpeed)

{

this.speed = this.maxSpeed;

}

}

printNowStatus ();

}

/** 減速 */

public void slowDown() {

// 只在啟動時可以減速

if (this.status)

{

this.speed = this.speed - 10;

if (this.speed 0)

{

this.speed = 0;

}

}

printNowStatus ();

}

/** 狀態(tài)打印,在每次啟動,加減速,關(guān)閉時調(diào)用 */

private void printNowStatus () {

System.out.println("轎車【" + this.brand + "】現(xiàn)在的啟動狀態(tài)是:" + this.status + "速度是:" + this.speed +"。");

}

}

public class TestCar

{

public static void main(String[] args)

{

Car myCar = new Car ("紅旗", 2, 120);

//啟動

myCar.start();

// 循環(huán)加速到120

while (myCar.getSpeed() 120)

{

myCar.speedUp();

}

//循環(huán)減速

while (myCar.getSpeed() 0)

{

myCar.slowDown();

}

//關(guān)閉

myCar.stop();

}

}

/* 直接拿文本寫的,我用的電腦沒裝jdk,樓主自己到Java開發(fā)環(huán)境下調(diào)試,應(yīng)該沒什么問題… */

JAVA面試題,請大家?guī)兔匆幌拢埮帕邢铝性创a順序,完成枚舉定義:

public enum Signal {

YELLOW, BLUE, RED {

public String info() {

return "Stop";

}

};

public String info() {

return "Signal Data";

}

}

B和E答案有誤。。。。

兩個答案是一樣的。。。

其中有一個應(yīng)該是};

后面有個分號。。。

假設(shè)B.}; E.}

那么排序結(jié)果應(yīng)該是: DCBAE

希望能幫到你。。。。仍有問題可以HI我。。。

java問題,求源代碼

import java.util.Scanner;

public class Q {

public static void main(String[] args) {

Scanner scan=new Scanner(System.in);

System.out.println("請輸入兩個字符");

String s=scan.nextLine();

boolean flag=true;

String msg="";

if(s.length()==2){

String first=s.substring(0,1);

String second=s.substring(1);

if(first.equals("M")){

msg+="數(shù)學(xué)";

}else if(first.equals("C")){

msg+="計算機(jī)科學(xué)";

}else if(first.equals("I")){

msg+="信息技術(shù)";

}else{

flag=false;

}

msg+=" ";

if(second.equals("1")){

msg+="大一";

}else if(second.equals("2")){

msg+="大二";

}else if(second.equals("3")){

msg+="大三";

}else if(second.equals("4")){

msg+="大四";

}else{

flag=false;

}

}

if(flag){

System.out.println(msg);

}else{

System.out.println("輸入不合法");

}

}

}

有問題請追問,沒問題請采納。

java 源代碼注釋

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.*;

public class GameTest extends JFrame implements ActionListener{

/*

* 新建一個主面板(這個類可能是自定義的,本程序和API中沒有)。

*/

MainPanel j=new MainPanel();

JButton jPreview;

JLabel label;

Container container;

JPanel panel;

/**

* 主函數(shù)

* @param args

*/

public static void main(String[] args) {

//運(yùn)行程序

new GameTest();

}

/**

* 構(gòu)造函數(shù)。

*

*/

public GameTest()

{

//新建一個標(biāo)題為“拼圖”的窗口

JFrame fr =new JFrame("拼圖");

//獲取窗口容器。

container=fr.getContentPane();

//創(chuàng)建菜單條

JMenuBar jMenuBar=new JMenuBar();

//以下初始化菜單,并且設(shè)置快捷鍵和添加監(jiān)聽器。

JMenu jMenuGame=new JMenu("游戲(G)");

jMenuGame.setMnemonic('g');

JMenuItem jMenuItemStart = new JMenuItem("開始(S)");

jMenuItemStart.setMnemonic('s');

jMenuItemStart.addActionListener(this);

JMenuItem jMenuItemExit=new JMenuItem("退出(E)");

jMenuItemExit.setMnemonic('e');

jMenuItemExit.addActionListener(this);

jMenuGame.add(jMenuItemStart);

jMenuGame.add(jMenuItemExit);

//初始化按鈕并設(shè)置快捷鍵和添加監(jiān)聽器

JButton jChoice=new JButton("選圖(X)");

jChoice.setMnemonic('x');

jChoice.addActionListener(this);

jPreview=new JButton("預(yù)覽(P)");

jPreview.setMnemonic('p');

jPreview.addActionListener(this);

//將菜單和按鈕添加到菜單條中

jMenuBar.add(jMenuGame);

jMenuBar.add(jChoice);

jMenuBar.add(jPreview);

//將菜單條設(shè)為該窗口的主菜單

fr.setJMenuBar(jMenuBar);

//將主面板添加到該窗口的容器中。

container.add(j);

//設(shè)置大小

fr.setSize(315,360 );

fr.setVisible(true);

//設(shè)置默認(rèn)關(guān)閉方式。

fr.setDefaultCloseOperation(3);

}

/**

* 事件處理函數(shù)。

*/

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand()=="開始(S)")

{

j.Start();

}

if(e.getActionCommand()=="預(yù)覽(P)")

{

j.setVisible(false);

panel=new JPanel();

Icon icon=new ImageIcon("pictrue/pic"+"_"+MainPanel.pictureID+".jpg");

label=new JLabel(icon);

label.setBounds(300, 300, 0, 0);

panel.add(label);

panel.setSize(300, 300);

panel.setVisible(true);

this.container.add(panel);

jPreview.setText("返回(P)");

}

if(e.getActionCommand()=="返回(P)")

{

panel.setVisible(false);

j.setVisible(true);

j.repaint();

jPreview.setText("預(yù)覽(P)");

}

if(e.getActionCommand()=="退出(E)")

{

System.exit(0);

}

if(e.getActionCommand()=="選圖(X)")

{

//初始化選擇框,并提供選擇。

Choice pic = new Choice();

pic.add("七里香");

pic.add("依然范特西");

pic.add("八度空間");

pic.add("十一月的肖邦");

pic.add("魔杰座");

pic.add("葉惠美");

pic.add("我很忙");

int i=JOptionPane.showConfirmDialog(this, pic, "選擇圖片", JOptionPane.OK_CANCEL_OPTION);

if(i==JOptionPane.YES_OPTION)

{

//選擇圖片

MainPanel.pictureID=pic.getSelectedIndex()+1;

j.removeAll();

j.reLoadPicture();

j.repaint();

}

}

}

}

java新手,求完整的源代碼

//都是從新手過來的,以下代碼供參考

//1.

public?class?BankAccount?{

private?static?String?acctnum;

private?static?double?money;

private?static?void?showAcct()?{

System.out.println("賬號為:?"?+?acctnum);

}

private?static?void?showMoney()?{

System.out.println("余額為:?"?+?money);

}

public?BankAccount(String?acc,?double?m)?{

this.acctnum?=?acc;

this.money?=?m;

}

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

BankAccount?ba?=?new?BankAccount("626600018888",?5000.00);

ba.showAcct();

ba.showMoney();

}

}

//2.

public?class?Triangle?{

private?static?float?a;

private?static?float?b;

private?static?float?c;

public?Triangle(float?a,?float?b,?float?c)?{

this.a?=?a;

this.b?=?b;

this.c?=?c;

}

public?static?boolean?judgeTriangle(float?a,?float?b,?float?c)?{

if?((a??Math.abs(b?-?c)??a??b?+?c)

?(b??Math.abs(a?-?c)??b??a?+?c)

?(c??Math.abs(a?-?b)??c??a?+?b))

return?true;

else

return?false;

}

public?float?getCircumference()?{

return?this.a?+?this.b?+?this.c;

}

}

//3.

public?class?TestTriangle?{

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

Triangle?t?=?new?Triangle(5.3f,7.8f,9.3f);

if(t.judgeTriangle(5.3f,7.8f,9.3f)){

System.out.print("能夠成三角形,周長為:?");

System.out.printf("%9.2f",t.getCircumference());}

else

System.out.println("不能構(gòu)成三角形");

}

}

什么是java源代碼 怎么查看

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

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

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

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

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

網(wǎng)頁標(biāo)題:java面試源代碼,csdn java面試
網(wǎng)站網(wǎng)址:http://chinadenli.net/article35/dsicipi.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站移動網(wǎng)站建設(shè)關(guān)鍵詞優(yōu)化App設(shè)計網(wǎng)站內(nèi)鏈響應(yīng)式網(wǎng)站

廣告

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

搜索引擎優(yōu)化