资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

激光刻字编程java代码,激光刻字编程java代码大全

java代码怎么写?

import java.util.Calendar;

我们注重客户提出的每个要求,我们充分考虑每一个细节,我们积极的做好成都做网站、成都网站设计服务,我们努力开拓更好的视野,通过不懈的努力,创新互联建站赢得了业内的良好声誉,这一切,也不断的激励着我们更好的服务客户。 主要业务:网站建设,网站制作,网站设计,小程序开发,网站开发,技术开发实力,DIV+CSS,PHP及ASP,ASP.Net,SQL数据库的技术开发工程师。

//这是问题(1)的函数

public static Boolean isLegal(int year,int month,int day){

boolean run=false;

if(month1||month12||day1||day31) return false;

if((year%4==0)(year%100!=0)||(year%400==0)) //是否是闰年

run=true;

switch(month){

case 2:

if(run){

if(day29) return false;

}

else{

if(day28) return false;

}

break;

case 4:

case 6:

case 9:

case 11:if(day30) return false;

}

return true;

}

//这是第(2)问的代码

Calendar cld = Calendar.getInstance();

cld.set(2009, 0,18);//月份是从0开始的

cld.set(Calendar.DAY_OF_YEAR, cld.get(Calendar.DAY_OF_YEAR)+365);

System.out.println(cld.getTime());

//结果是:Mon Jan 18 13:50:40 CST 2010

//下面是第三问的代码

Calendar cld1 = Calendar.getInstance();

cld1.set(2009, 0,18);//月份是从0开始的

Calendar cld2 = Calendar.getInstance();

cld2.set(2008, 0,18);

long d=cld1.getTimeInMillis()-cld2.getTimeInMillis();

d=d/1000/60/60/24;

System.out.println(d);

//结果是366

Java编程(写出程序代码)

写了一个代码,代码如下,可以进行参考

public class sum {

public static void main(String[] args) {

//创建一个Scanner的对象input

Scanner input = new Scanner(System.in); 

//提示用户输入数据 

System.out.print("请输入一个整数");

//将输入的值赋给n

int n = input.nextInt();

//定义变量接收计算后的和

int sum = 0;

//利用循环进行求和

for (int i = 0; i = n; i++) {

sum+=i;

}

//输出最后的和

System.out.println("从0一直到"+n+"的所有整数的和是:"+sum);

}

}

Java编程,填写下面的代码

class NoLowerLetterException extends Exception {

public NoLowerLetterException(String msg) {

super(msg);

}

}

class NoDigitException extends Exception {

public NoDigitException(String msg) {

super(msg);

}

}

class People {

void printLetter(char c) {

if (c = 'a' c = 'z') {

System.out.println(c);

} else {

try {

throw new NoLowerLetterException(String.valueOf(c));

} catch (NoLowerLetterException e) {

e.printStackTrace();

}

}

}

void printDigit(char c) {

if (c = '0' c = '9') {

System.out.println(c);

} else {

try {

throw new NoDigitException(String.valueOf(c));

} catch (NoDigitException e) {

e.printStackTrace();

}

}

}

}

public class ExceptionExample {

public static void main(String args[]) {

People people = new People();

for (int i = 0; i 128; i++) {

// 【代码5】

// //将i转换为char类型,执行people.printLetter()方法,如果出现异常则捕获,并输出异常的错误信息!

people.printLetter((char) i);

}

for (int i = 0; i 128; i++) {

// 【代码6】 //将i转换为char类型,执行people. printDigit

// ()方法,如果出现异常则捕获,并输出异常的错误信息!

people.printDigit((char) i);

}

}

}

用JAVA 帮忙写下代码,编程

Media类:

import java.util.Scanner;

/**

* @author Administrator

*

*/

public class Media {

private String name;

private String author;

private String publish;

private double price;

/**

* @throws Exception

*/

public Media() throws Exception

{

@SuppressWarnings("resource")

Scanner scanner = new Scanner(System.in);

System.out.println("请输入名称:");

setName(scanner.nextLine());

System.out.println("请输入作者:");

setAuthor(scanner.nextLine());

System.out.println("请输入出版社:");

setPublish(scanner.nextLine());

System.out.println("请输入价格:");

setPrice(scanner.nextDouble());

scanner.close();

}

/**

* @return the name

*/

public String getName() {

return name;

}

/**

* @param name the name to set

*/

public void setName(String name) {

this.name = name;

}

/**

* @return the author

*/

public String getAuthor() {

return author;

}

/**

* @param author the author to set

*/

public void setAuthor(String author) {

this.author = author;

}

/**

* @return the publish

*/

public String getPublish() {

return publish;

}

/**

* @param publish the publish to set

*/

public void setPublish(String publish) {

this.publish = publish;

}

/**

* @return the price

*/

public double getPrice() {

return price;

}

/**

* @param price the price to set

*/

public void setPrice(double price) {

this.price = price;

}

}

public class Book extends Media {

/**

* @throws Exception

*

*/

public Book() throws Exception{

super();

System.out.println("I am a book!");

}

}

public class Cd extends Media {

/**

*

* @throws Exception

*/

public Cd() throws Exception{

super();

System.out.println("I am a cd!");

}

}

java 编程

class Printer {

public String type;

public String manner;

public Printer(){};

public Printer(String type,String manner){

this.type=type;

this.manner=manner;

}

public void startup(){

System.out.println("启动普通打印机");

}

public void print(){

System.out.println("普通打印机打印");

}

}

class LaserPrinter extends Printer{

public void print(){

System.out.println("激光打印机打印");

}

public void close(){

System.out.println("激光打印机关闭");

}

}

public class Test{

public static void main(String[] args){

Printer p1=new Printer();

Printer p2=new Printer("123","方式1");

p1.startup();

p1.print();

LaserPrinter j1= new LaserPrinter();

j1.startup();

j1.print();

j1.close();

}

}


新闻标题:激光刻字编程java代码,激光刻字编程java代码大全
当前URL:http://cdkjz.cn/article/dssdpio.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220