java十大编程代码 优秀java代码

Java编程 代码如下"13423"
foo(0) 时 output 值为"134"
foo(1) 诗 output 值为"13423"
因为finally无论出没出现异常都会要执行java十大编程代码的java十大编程代码,哪怕java十大编程代码你写java十大编程代码了return 。所以finally语句块常用来“收尾”工作 。
求JAVA编程代码答案放在下面地址java十大编程代码:
顺便给我踩下空间^-^
本小牛听了那六级大牛的建议后做了如下修改
第1题:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class wangquanshu extends Applet implements ActionListener
{
int aa[]={6,28,496,8128,130816,2096128,33550336},bb[]={0,0,0,0,0,0,0};
//6=1+2+3
//28=1+2+4+7+14
//496=1+2+4+8+16+31+62+124+248
//8128=1+2+4+8+16+32+64+127+254+508+1016+2032+4064
//在1到40000000这么多数里java十大编程代码 , 只有七个完全数,它们是:6,28,496,8128,130816,2096128,33550336
//java里int 32位 -2^31~2^31-1(大概20亿,应够了)
int j,q;
Label lab1;
TextField text1;
Label lab2;
TextField text2;
Button but;
public void init()
{lab1=new Label("请输入上下限:");
text1=new TextField(8);
lab2=new Label(" - ");
text2=new TextField(8);
but=new Button("确定");
add(lab1);
add(text1);
add(lab2);
add(text2);
add(but);
but.addActionListener(this);
}
public void paint(Graphics g)
{int m=1;//用于控制输出自由数的位置
for(int n=0;n7;n++)
{g.drawString(" "+bb[n],10,50+m*20);
m++;
}
}
public void actionPerformed(ActionEvent e)
{int s=0;
int a=Integer.parseInt(text1.getText());
int b=Integer.parseInt(text2.getText());
for(j=0;j7;j++)
{if(aa[j]aaa[j]b)
bb[j]=aa[j];
}
repaint();
}
}
第2题:
import java.io.*;
import java.text.DecimalFormat;
public class e
{public static void main(String args[])
{double ee=0;
for(int i=0;i=11;i++)
{ee=ee+1/re(i);
}
DecimalFormat a=new DecimalFormat("0.00000000");
System.out.println(a.format(ee));
}
static double re(int n)
{if(n==0||n==1) return 1;
else return n*re(n-1);
}
}
急?。。〖虻AVA编程代码public class Test {
public static void main(String[] args) {
MyRectangle rec = new MyRectangle(3, 5);
MyRectangle square = new MySquare(4);
System.out.println(rec.toString());
System.out.println(square.toString());
}
}
class MyRectangle{
protected double width;
protected double length;
public MyRectangle(double length, double width){
this.width = width;
this.length = length;
}
public double getLength() {
return length;
}
public double getWidth() {
return width;
}
public void setWidth(double width) {
this.width = width;
}
public double getArea(){
return this.width * this.length;
}
public String toString(){
return "长方形java十大编程代码的长为:" + length + ", 宽: " + width + ", 面积为:" + getArea();
}
}
class MySquare extends MyRectangle{
public MySquare(double length){
super(length, length);
}
public double getArea(){
return Math.pow(super.width, 2);
}
public String toString(){
return "正方形边长为: " + super.length + ", 面积为: " + getArea();
}
}
----------测试
长方形java十大编程代码的长为:3.0, 宽: 5.0, 面积为:15.0
正方形边长为: 4.0, 面积为: 16.0
Java编程(写出程序代码)写了一个代码,代码如下,可以进行参考

推荐阅读