包含java编程综合实例代码的词条
java编程(写出程序代码)
public class Test {
10年积累的做网站、网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站策划后付款的网站建设流程,更有桥东免费网站建设让你可以放心的选择与我们合作。
public static void main(String[] args) {
// 定义数组
int[][] array = new int[5][6];
// 生成随机数初始化数组
for (int i = 0; i array.length; i++) {
for (int j = 0; j array[i].length; j++) {
array[i][j] = (int) (40 * Math.random()) + 10;
}
}
// 输出数组
for (int i = 0; i array.length; i++) {
for (int j = 0; j array[i].length; j++) {
System.out.print(array[i][j] + "\t");
}
System.out.println(); // 换行
}
}
}
Java编程求代码
这个是需要用JAVASCRIPT或者JQUERY 解决吧,这属于JSP的问题吧。
思路 :如果是JQUERY 需要定义一个function 方法名(参数)将按钮A绑定一个双击事件 (参数是A或者是其对应的ascii码 65)如果参数是大写的A 则需要在方法体内将其转成 对应ascii码。具体复制的实现 :如果A按钮 input type="button" id = "a"在一个DIV内 如div id ="div"
input type="button" id = "a"A/input
/div
只需要 获取当前ID为div的div$("#div") 之后再起后边加入通过append方法在A的后边加入按钮B(A+1)(所以首先应该将传入的参数65 加1获取其下一个字母) 。具体实现$("#div")
.append(input type="button" 双击事件="方法名(新获得的字母)"新获得的字母/input);取消参数按钮绑定 给新获得的字母绑定双击事件。
一道Java编程题 求源代码
public class Invoice {
String bianhao = null;
String shuoming = null;
int count = 0;
double price = 0.0;
public Invoice(String bianhao, String shuoming, int count, double price) {
this.bianhao = bianhao;
this.shuoming = shuoming;
if (count 0) {
this.count = 0;
} else {
this.count = count;
}
if (price 0.0) {
this.price = 0.0;
} else {
this.price = price;
}
}
public double getInvoiceAmount() {
return count * price;
}
public String getBianhao() {
return bianhao;
}
public void setBianhao(String bianhao) {
this.bianhao = bianhao;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getShuoming() {
return shuoming;
}
public void setShuoming(String shuoming) {
this.shuoming = shuoming;
}
}
public class InvoiceTest {
/**
* @param args
*/
public static void main(String[] args) {
Invoice invoice = new Invoice("010220", "Desk", 50, 53.9);
System.out.println(invoice.getInvoiceAmount());
}
}
JAVA编程
这个应该不是在运行时提示, 应该编译器就会提示, 因为你写的三个方法都是非静态的, 而你的main方法 静态的, 所以你无法直接在main方法中调用那个三个字符串处理方法, 你要先实例化一个Strinput的对象然后通过这个对象调用那三个方法
java编程代码!请仔细看我的说明. . .
我来帮您,代码如下:
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
public class A extends JFrame {
private static final long serialVersionUID = 1L;
JProgressBar pb;
A() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
setLocation(400, 100);
getContentPane().setLayout(null);
pb = new JProgressBar(); // 改动1
pb.setBounds(10, 201, 212, 40);
getContentPane().add(pb);
setTitle("滚动条测试!");
pb.setStringPainted(true);
final JLabel label = new JLabel();
label.setText("正在登陆验证,请稍候。。。");
label.setBounds(10, 179, 212, 18);
getContentPane().add(label);
final JLabel label03 = new JLabel();
label03.setBounds(49, 247, 13, 18);
getContentPane().add(label03);
final JLabel label04 = new JLabel();
label04.setBounds(68, 247, 13, 18);
getContentPane().add(label04);
final JLabel label05 = new JLabel();
label05.setBounds(86, 247, 13, 18);
getContentPane().add(label05);
final JLabel label06 = new JLabel();
label06.setBounds(105, 247, 13, 18);
getContentPane().add(label06);
final JLabel label07 = new JLabel();
label07.setBounds(124, 247, 13, 18);
getContentPane().add(label07);
final JLabel label02 = new JLabel();
label02.setBounds(30, 247, 13, 18);
getContentPane().add(label02);
final JLabel label01 = new JLabel();
label01.setBounds(10, 247, 13, 18);
getContentPane().add(label01);
final JLabel label08 = new JLabel();
label08.setBounds(143, 247, 13, 18);
getContentPane().add(label08);
final JLabel label09 = new JLabel();
label09.setBounds(162, 247, 13, 18);
getContentPane().add(label09);
final JLabel label10 = new JLabel();
label10.setBounds(177, 247, 13, 18);
getContentPane().add(label10);
JButton btn1 = new JButton("登陆");
btn1.addActionListener(new ActionListener() {
private int i;
public synchronized void actionPerformed(final ActionEvent e) {
new Thread() {
public synchronized void run() {
for (i = 0; i = 100; i++) {
pb.setValue(i);
try {
Thread.currentThread();
Thread.sleep(200);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
switch (i) {
case 0:
label01.setText("*");
break;
case 10:
label01.setText("*");
label02.setText("*");
break;
case 20:
label01.setText("*");
label02.setText("*");
label03.setText("*");
break;
case 30:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
break;
case 40:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
break;
case 50:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
label06.setText("*");
break;
case 60:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
label06.setText("*");
label07.setText("*");
break;
case 70:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
label06.setText("*");
label07.setText("*");
label08.setText("*");
break;
case 80:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
label06.setText("*");
label07.setText("*");
label08.setText("*");
label09.setText("*");
break;
case 90:
label01.setText("*");
label02.setText("*");
label03.setText("*");
label04.setText("*");
label05.setText("*");
label06.setText("*");
label07.setText("*");
label08.setText("*");
label09.setText("*");
label10.setText("*");
break;
case 100:
JOptionPane.showMessageDialog((new A()
.getContentPane()), "登陆成功", "恭喜您!",
JOptionPane.WARNING_MESSAGE);
label01.setText("");
label02.setText("");
label03.setText("");
label04.setText("");
label05.setText("");
label06.setText("");
label07.setText("");
label08.setText("");
label09.setText("");
label10.setText("");
pb.setValue(0);
}
}
}
}.start();
}
});
btn1.setBounds(86, 92, 90, 39);
Container con = getContentPane();
con.add(btn1);
}
public static void main(String[] args) {
new A().setVisible(true);
}
}
文章名称:包含java编程综合实例代码的词条
网站路径:http://cdiso.cn/article/dssocii.html