导航:首页 > 程序命令 > 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程序员圣诞代码相关的资料

热点内容
学习编程的思路 浏览:222
app易语言post怎么学 浏览:963
地梁的箍筋加密区位置 浏览:300
二分法排序程序及编译结果 浏览:677
日语命令形和禁止型 浏览:283
安装软件用管理员解压 浏览:503
编译原理代码块 浏览:398
小孩可以用压缩面膜吗 浏览:12
锥形倒角怎么计算法 浏览:880
java合并链表 浏览:505
pic单片机编译器 浏览:803
丽水四轴加工中心编程 浏览:689
国产系统怎么解压 浏览:552
战双程序员 浏览:483
him触摸编程软件 浏览:931
植物大战僵尸存档怎么转移安卓 浏览:852
java栈的元素 浏览:739
程序员与篮球事件 浏览:676
app反编译不完整 浏览:789
电脑上的文件夹怎么调整 浏览:10