网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

包含pl0编译器java代码的词条

编写Java程序,要求在命令行窗口输出二十六个英文字母的大小写。

public class PrintLetter

创新互联专业为企业提供察哈尔右翼前网站建设、察哈尔右翼前做网站、察哈尔右翼前网站设计、察哈尔右翼前网站制作等企业网站建设、网页设计与制作、察哈尔右翼前企业网站模板建站服务,十多年察哈尔右翼前做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

{

public static void main(String args [])

{

PrintLetter pl = new PrintLetter();

pl.printLowerCase ();

pl.printUpperCase ();

}

void printLowerCase ()

{

System.out.println("\n");

char a='a';

for(int i=0;i26;i++)

   {

   System.out.print(a+" ");

   a++;

   } 

}

void printUpperCase ()

{

System.out.println("\n");

char a='A';

for(int i=0;i26;i++)

   {

   System.out.print(a+" ");

   a++;

   } 

}

}

要用java编的计算器代码

给你一个比较简单的吧。以前写的。

共两个类。还只是完成+、-、×、÷运算而已。

GUI只是用了AWT,很简单,相信一看就能懂了。

Calculator.java

public class Calculator{

private String result = "0";

private int op = 0,add = 1,sub = 2,mul = 3,div = 4;

private double stringToDouble(String x){

double y = Double.parseDouble(x);

return y;

}

private void operate(String x){

double x1 = stringToDouble(x);

double y = stringToDouble(result);

switch (op){

case 0:

result = x;

break;

case 1:

result = String.valueOf(y+x1);

break;

case 2:

result = String.valueOf(y-x1);

break;

case 3:

result = String.valueOf(y*x1);

break;

case 4:

if(x1!=0){

result = String.valueOf(y/x1);

}else{

result = "The divisor can't be zero!";

}

break;

}

}

public String opAdd(String x){

operate(x);

op = add;

return result;

}

public String opSubtract(String x){

operate(x);

op = sub;

return result;

}

public String opMultiply(String x){

operate(x);

op = mul;

return result;

}

public String opDivide(String x){

operate(x);

op = div;

return result;

}

public String opEquals(String x){

operate(x);

op = 0;

return result;

}

public void opClean(){

op = 0;

result = "0";

}

}

CalculatorGUI.java

import java.awt.*;

import java.awt.event.*;

import java.util.EventObject;

public class CalculatorGUI{

private Frame f;

private Panel p1,p2;

private Button b0,b1,b2,b3,b4,b5,b6,b7,b8,b9;

private Button bPoint,bAdd,bDec,bMul,bDiv,bCal;

private TextField tf;

private String s,op;

private Calculator cal = new Calculator();

private boolean ifOp;

public CalculatorGUI(){

f = new Frame("Calculator");

p1 = new Panel();

p2 = new Panel();

b0 = new Button("0");

b1 = new Button("1");

b2 = new Button("2");

b3 = new Button("3");

b4 = new Button("4");

b5 = new Button("5");

b6 = new Button("6");

b7 = new Button("7");

b8 = new Button("8");

b9 = new Button("9");

bPoint = new Button(".");

bAdd = new Button("+");

bDec = new Button("-");

bMul = new Button("*");

bDiv = new Button("/");

bCal = new Button("=");

tf = new TextField(25);

tf.setEditable(false);

}

public void launchFrame(){

f.setSize(220,160);

f.setResizable(false);

f.addWindowListener(new myWindowListener());

p1.setLayout(new FlowLayout(FlowLayout.CENTER));

p1.add(tf);

f.add(p1,BorderLayout.NORTH);

p2.setLayout(new GridLayout(4,4));

b0.addActionListener(new setLabelText_ActionListener());

b1.addActionListener(new setLabelText_ActionListener());

b2.addActionListener(new setLabelText_ActionListener());

b3.addActionListener(new setLabelText_ActionListener());

b4.addActionListener(new setLabelText_ActionListener());

b5.addActionListener(new setLabelText_ActionListener());

b6.addActionListener(new setLabelText_ActionListener());

b7.addActionListener(new setLabelText_ActionListener());

b8.addActionListener(new setLabelText_ActionListener());

b9.addActionListener(new setLabelText_ActionListener());

bPoint.addActionListener(new setLabelText_ActionListener());

bAdd.addActionListener(new setOperator_ActionListener());

bDec.addActionListener(new setOperator_ActionListener());

bMul.addActionListener(new setOperator_ActionListener());

bDiv.addActionListener(new setOperator_ActionListener());

bCal.addActionListener(new setOperator_ActionListener());

p2.add(b7);

p2.add(b8);

p2.add(b9);

p2.add(bAdd);

p2.add(b4);

p2.add(b5);

p2.add(b6);

p2.add(bDec);

p2.add(b1);

p2.add(b2);

p2.add(b3);

p2.add(bMul);

p2.add(b0);

p2.add(bPoint);

p2.add(bCal);

p2.add(bDiv);

f.add(p2,BorderLayout.SOUTH);

f.setVisible(true);

}

public void setTextFieldText_Temp(){

if (tf.getText().length()15 (tf.getText().indexOf(".")==-1 || !s.equals("."))){

tf.setText(tf.getText()+s);

}else{

tf.setText((tf.getText()+s).substring(0,15));

}

}

public void setTextFieldText(){

if(ifOp){

ifOp = false;

tf.setText("");

setTextFieldText_Temp();

}else{

setTextFieldText_Temp();

}

}

public static void main(String[] args){

CalculatorGUI calculator = new CalculatorGUI();

calculator.launchFrame();

}

class myWindowListener extends WindowAdapter{

public void windowClosing(WindowEvent e){

System.exit(0);

}

}

class setLabelText_ActionListener implements ActionListener{

public void actionPerformed(ActionEvent e){

Button tempB = (Button)e.getSource();

s = tempB.getLabel();

setTextFieldText();

}

}

class setOperator_ActionListener implements ActionListener{

public void actionPerformed(ActionEvent e){

Button tempB = (Button)e.getSource();

op = tempB.getLabel();

if(op.equals("+")){

tf.setText(cal.opAdd(tf.getText()));

ifOp = true;

}else if(op.equals("-")){

tf.setText(cal.opSubtract(tf.getText()));

ifOp = true;

}else if(op.equals("*")){

tf.setText(cal.opMultiply(tf.getText()));

ifOp = true;

}else if(op.equals("/")){

tf.setText(cal.opDivide(tf.getText()));

ifOp = true;

}else if(op.equals("=")){

tf.setText(cal.opEquals(tf.getText()));

ifOp = true;

}

}

}

}

用java代码实现Oracle数据库的备份与恢复(保存为.dmp或.sql)

备份:发送sql给mssqlserver:

backup database your database name to disk='备份文件名' with init

注意: 1.备份文件名必须为绝对路径,

2.备份文件只能是mssqlserver所在的机器上的路径, mssql支持备份到网络位置。

恢复:

restore database your database name from disk='备份文件名' with replace

要注意的是执行restore database时,要恢复的数据库必须没有任何客户端连接,包括自身(发起restore database命令的连接)。发使用restore,可以连接到master库,然后再发送restore命令。

否则,一定失败。

在jsp中如何用呢

-------------------------------------------------------------------------------------- 你用这个了!

%

先要连接上Connection对象!

就是要先和数据库建立起连接

然后在jsp页面中直接用我这样的语句就可以了

try{

String sql="backup database xncsims to disk='d:\\xncback.dat'";

st=con.createStatement();

rs=st.executeQuery(sql);

}

catch(SQLException e){ System.out.println(e.toString());}

catch(Exception e){ System.out.println(e.toString());}

%

rs=st.executeQuery(sql);

这里就是把你的SQL语句发到数据库执行

另有一篇论文供参考


分享题目:包含pl0编译器java代码的词条
路径分享:http://bjjierui.cn/article/hoieod.html

其他资讯