導航:首頁 > 程序命令 > java程序員聖誕代碼

java程序員聖誕代碼

發布時間:2022-07-24 23:05:09

㈠ 請java程序員看看我的代碼,哪裡有問題

第5行:數組用方括弧,不是圓括弧。int sc = new int[6];
第6行:數組聲明錯了,邊界溢出了,聲明用int[] sc,sc數組的下標是0-5。
其他錯誤:sc[i]是變化的,不能引用nextIni方法。
我給你修改一下吧:
import java.util.*;
public class Test{
public static void main(String[] args){
System.out.println("Enter:");
int[] sc = new int[6];
Scanner input = new Scanner(System.in);
for(int i = 0;i < sc.length;i++){
sc[i] = input.nextInt();
}
Arrays.sort(sc);
for(int elements:sc){
System.out.print(elements + " ");
}
}
}

㈡ 程序員的表白代碼

程序員的表白代碼

第一條語言:Java代碼翻譯:直到死之前,每天愛你多一點代碼:while(lifeend){love++;}

第二條語言:C語言代碼翻譯:.代碼:#incldestdio.hintmain(){printf(HelloWorldn);retrn0;}//.

第三條語言:python代碼翻譯:山無陵,江水為竭,冬雷震震,夏雨雪,天地合,乃敢與君絕!代碼:if(mountain.arris==None):if(river.water==None):if(winter.thunder==True):if(summer.snow==True):if(sky.height==ground.height):i.withyou=Falseelse:i.withyou=True.

第四條語言:Erlang代碼代碼翻譯:深圳相遇,至死不渝代碼:-mole(you_and_me).-export([start/1]).-record(person,{name,address,status}).start(Name)-one_world(Name).one_world(Name)keep_to_love_you(Person).say_goodbye(Person)-io:format(~p:seeyounextworld!~n,[Person#person.name]).see_you_next_world(Name)-one_world(Name).

第五條語言:Java語言代碼翻譯:愛你到天荒地老代碼:while(!world.destroy){System.out.println(iloveyou);}

㈢ 優秀Java程序員都是怎樣寫代碼的

1.編碼之前想一想
用10分鍾,20分鍾甚至30分鍾的時間來想想你需要什麼,想想什麼樣的設計模式適合你將要編碼的東西。你會很慶幸「浪費」了那幾分鍾,當你不得不更改或添加東西到代碼中時你就不將將浪費幾分鍾而是要花費更多的時間。
2.注釋你的代碼
說真的,沒有什麼比兩個月後檢查自己的代碼,卻不記得它用來干什麼更糟糕的了。注釋所有重要的內容,當然那些顯而易見的就免了吧。
3.寫干凈的代碼
錯落有致。使用空格。根據功能模塊化你的代碼。閱讀RobertC.Martin寫的《CleanCode》,非常有幫助。此外,遵循代碼約定/標准(如,尤其如果是共享的代碼。
4.重構
沒有人喜歡用那些超級長的方法。這通常(幾乎總是)意味著你混雜了功能。用更易於管理的方法分離代碼。還能使得代碼更可重用。
5.不要復制粘貼代碼
如果你有兩個或兩個以上相同的代碼塊,那麼你可能做錯了什麼。閱讀第4條。
6.使用有意義的名稱
雖然命名int變數為「elligent」或char為「mander」是很好笑;但是,這樣的名稱並不能說明變數是用來做什麼的。
7.測試代碼
測試,測試,測試,還是測試。測試你的代碼。不要等到已經做完程序之後再來測試,否則當你發現一個巨大的bug,卻不知道它來自於哪裡來的時候,你會追悔莫及。
自動化測試通常都是有價值的。它還有助於節省大量重測試和回歸測試的時間。

㈣ 現在java程序員用什麼編寫代碼

eclipse ,myeclipse比較多。 但建議用idea的產品,現在免費了。提示功能很強大。eclipse有很多功能是模仿他的,但是現在用的人不是很多。

㈤ 求程序員幫忙寫個Java代碼,因為今天我有事沒時間做,明天要交作業,謝謝了

代碼如下,隨便附一句,一定要看寫的源碼,我已經盡量馬馬虎虎的寫了,你更容易看懂。

publicclassTest{

//第八題
publicstaticfinalintNUM=100;
publicstaticfinaldoubleGOOD=99.99;
="Test.Class";
publicstaticfinallongMAX=9999999;

publicstaticvoidmain(String[]args){

//第一題
bytebyte1=1;
shortshort1=1;
intint1=1;
longlong1=1;
floatfloat1=1;
doubledouble1=1.0;

System.out.println("byte1-"+byte1);
System.out.println("short1-"+short1);
System.out.println("int1-"+int1);
System.out.println("long1-"+long1);
System.out.println("float1-"+float1);
System.out.println("double1-"+double1);

//第二題
Stringname;
charsex;
intage;
booleanisMember;

//第三題
intscore1;
doublescore2=98.5;

//第四題
doublef1=10.1,f2=34.2;
System.out.println("f1,f2的和:"+(f1+f2));
System.out.println("f1,f2的差:"+(f1-f2));
System.out.println("f1,f2的積:"+(f1*f2));
System.out.println("f1,f2的商:"+(f1/f2));

//第五題
intf3=5;
doublef4=45.6;
System.out.println("f3,f4的和:"+(f3+f4));
System.out.println("f3,f4的差:"+(f3-f4));
System.out.println("f3,f4的積:"+(f3*f4));
System.out.println("f3,f4的商:"+(f3/f4));

//第六題
intA=65;
chara=(char)A;
System.out.println("整型互轉char:"+a);

//第七題
doubletimor=123.456789;
intx=Integer
.parseInt(newjava.text.DecimalFormat("0").format(timor));//四捨五入
System.out.println("double->int:"+x);

//第八題(定義在最開始)
System.out.println("常量NUM的值:"+NUM);
System.out.println("常量GOOD的值:"+GOOD);
System.out.println("常量CLASSNAME的值:"+CLASSNAME);
System.out.println("常量MAX的值:"+MAX);

//第九題(自定義商品類)
classGoods{

privateStringname;
privatedoubleprice;
privateintcount;
privatedoubletotal;

publicGoods(Stringname,doubleprice,intcount){
this.name=name;
this.price=price;
this.count=count;
}

publicvoidprint(){
total=price*count;
System.out.println("商品名 價格數量 總價");
System.out.println(name+" "+price+" "+count+" "
+total);
}

}
Goodsgoods=newGoods("蘋果",2,10);
goods.print();

//第十題
doublepi=3.14,r,d;
r=4;
d=2*r;

System.out.println("圓的周長:"+(pi*d));
System.out.println("圓的面積:"+(pi*r*r));

//第十一題
Stringqqname="1234567890";
Stringqqpassword="asd!#@#$%66";
Datebirth=newDate(2014,5,1);
booleanisVIP=false;
charsex1='男';
StringBuilderpersonInfo=newStringBuilder();
personInfo.append("我是一個快樂的騷年");
personInfo
.append("然後a!#$%^&*");

//第十二題
classSwaper{
publicvoidchange(intnum1,intnum2){
inttemp=num1;
num1=num2;
num2=temp;
System.out.printf("a=%d,b=%d ",num1,num2);
}

}

inta1=2;
intb1=5;
Swaperswaper=newSwaper();
swaper.change(a1,b1);
}
}

㈥ 給程序員編寫高效java代碼的幾條建議

張小喜告別996 實現高效編程 減少開發壓力 開啟Java高效編程之門(完整版高清視頻)網路網盤

鏈接: https://pan..com/s/1kKaGzsXHu3Cy7MqvIY7r3g

提取碼: aizj 復制這段內容後打開網路網盤手機App,操作更方便哦

若資源有問題歡迎追問~

㈦ 求大型JAVA程序的原代碼

用java 寫的發郵件程序的原代碼1
Properties properties = System.getProperties();
properties.put("mail.smtp.host","smtp.sina.com.cn");
properties.put("mail.transport.protocol", "smtp");
properties.put("mail.smtp.auth","true");
Session session = Session.getInstance(properties,
new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(strUserName,strPassword);
}
});
try
{
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(strMail));
InternetAddress[] toadd = InternetAddress.parse(strEmailTo);
message.setRecipients(Message.RecipientType.TO,toadd);

message.setSubject(strSubject,"Shift_JIS");
message.setText(strFullMailText,"Shift_JIS");

Transport transport = session.getTransport();
message.saveChanges();
transport.send(message,message.getAllRecipients());
transport.close();

}
catch (AddressException e)
{
}
catch (SendFailedException e)
{
}
catch (MessagingException e)
{
}

再給你一個java計算器原代碼
import java.awt.*;
import java.awt.event.*;
public class Calculator extends WindowAdapter implements ActionListener
{
private double result=0,data1=0,radixPointDepth=1;
private boolean radixPointIndicate=false,resultIndicate=false;
private char prec='+';
private Frame f;
private TextField tf;
private Button b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17;
private Panel p;
static public void main(String args[])
{
Calculator de=new Calculator();
de.go();
}
public void go()
{
f=new Frame("計算器");
p=new Panel();
p.setLayout(new GridLayout(4,4));
tf=new TextField(30);
b1=new Button("7");
b2=new Button("8");
b3=new Button("9");
b4=new Button("+");
b5=new Button("4");
b6=new Button("5");
b7=new Button("6");
b8=new Button("-");
b9=new Button("1");
b10=new Button("2");
b11=new Button("3");
b12=new Button("*");
b13=new Button("0");
b14=new Button(".");
b15=new Button("=");
b16=new Button("/");
b17=new Button("清零");
f.add(tf,"North");
f.add(p,"Center");
f.add(b17,"South");
p.add(b1);
p.add(b2);
p.add(b3);
p.add(b4);
p.add(b5);
p.add(b6);
p.add(b7);
p.add(b8);
p.add(b9);
p.add(b10);
p.add(b11);
p.add(b12);
p.add(b13);
p.add(b14);
p.add(b15);
p.add(b16);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b10.addActionListener(this);
b11.addActionListener(this);
b12.addActionListener(this);
b13.addActionListener(this);
b14.addActionListener(this);
b15.addActionListener(this);
b16.addActionListener(this);
b17.addActionListener(this);
f.addWindowListener(this);
f.setSize(250,190);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String s;
s=e.getActionCommand();
switch(s.charAt(0))
{
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
if(resultIndicate)
{
result=0;
data1=0;
prec='+';
}
Integer Int1=new Integer(s);
if(radixPointIndicate)
{
radixPointDepth=radixPointDepth/10;
data1=data1+(Int1.intValue())*radixPointDepth;
}
else
{
data1=data1*10+(Int1.intValue());
}
Double displayNumber=new Double(data1);
tf.setText(displayNumber.toString());
resultIndicate=false;
break;
case '+': case '-':case '*':case '/':case '=':
if(s.charAt(0)!='='&&resultIndicate)
{
prec=s.charAt(0);
resultIndicate=false;
}
else
{
switch(prec)
{
case '+':
result=result+data1;
break;
case '-':
result=result-data1;
break;
case '*':
result=result*data1;
break;
case '/':
result=result/data1;
break;
}
}
radixPointIndicate=false;
radixPointDepth=1;
displayNumber=new Double(result);
tf.setText(displayNumber.toString());
if(s.charAt(0)!='=')
{
data1=0;
prec=s.charAt(0);
}
else
{
resultIndicate=true;
}
break;
case '.':
radixPointIndicate=true;
break;
}
if(s.equals("清零"))
{
result=0;
data1=0;
radixPointDepth=1;
tf.setText("");
}
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}

閱讀全文

與java程序員聖誕代碼相關的資料

熱點內容
諾貝爾pdf 瀏覽:967
雲伺服器快速安裝系統原理 瀏覽:788
蘋果騰訊管家如何恢復加密相冊 瀏覽:115
手機軟體反編譯教程 瀏覽:858
sqlserver編程語言 瀏覽:650
gpa國際標准演算法 瀏覽:238
伺服器編程語言排行 瀏覽:947
怎麼下載快跑app 瀏覽:966
小紅書app如何保存視頻 瀏覽:170
如何解開系統加密文件 瀏覽:809
linux切換root命令 瀏覽:283
c編譯之後界面一閃而過怎麼辦 瀏覽:880
怎麼看ic卡是否加密 瀏覽:725
lgplc編程講座 瀏覽:809
cnc手動編程銑圓 瀏覽:723
cad中幾種命令的意思 瀏覽:327
oraclelinux安裝目錄 瀏覽:134
安卓系統可以安裝編譯器嗎 瀏覽:572
javajson實體類 瀏覽:692
板加密鋼筋是否取代原鋼筋 瀏覽:69