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

定制建站费用3500元

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

成都品牌网站建设

品牌网站建设费用6000元

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

成都商城网站建设

商城网站建设费用8000元

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

成都微信网站建设

手机微信网站建站3000元

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

建站知识

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

JAVA实现生日快乐代码,用代码生日快乐

谁会用java写一下关于生日快乐的,SOS

public class Birthday{

创新互联公司专注于安泽企业网站建设,响应式网站开发,成都商城网站开发。安泽网站建设公司,为安泽等地区提供建站服务。全流程按需定制,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务

public static void main(String args[]){

System.out.println("凯旋,生日快乐");

}

}

java编写一个简单的输入生日计算下一个生日时间的代码?

import java.util.Calendar;

import java.util.Scanner;

import java.util.concurrent.TimeUnit;

/**

* Title: Test03.javabr

* Description:

*

* @author 王凯芳

* @date 2020年3月5日 下午6:03:04

* @version 1.0

*

* @request 编写一个方法能计算任何一个人今天离他最近下一次生日还有多少天,然后在主方法(main方法)中输入你的出生年月日,调用该方法的计算结果并输出信息“某某同学离自己最近下一次生日x天”。

*/

public class Test03 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("请输入你的姓名:");

String name = sc.nextLine();

System.out.println("请输入你的生日,格式为(2000/01/01):");

String line = sc.nextLine();

String[] strs = line.split("/");

if (strs.length == 3) {

int days = getDays(strs[0], strs[1], strs[2]);

if (days == 0) {

System.out.println(String.format("%s 同学,今天是你的生日,祝你生日快乐(#^.^#)", name, days));

} else {

System.out.println(String.format("%s 同学离自己最近下一次生日%d天。", name, days));

}

} else {

System.out.println("生日输入不正确!请按格式输入。");

}

sc.close();

}

/**

* 获取最近一次生日天数

*

* @param year

* @param month

* @param day

* @return

*/

public static int getDays(String year, String month, String day) {

Calendar now = Calendar.getInstance();

now.set(Calendar.HOUR_OF_DAY, 0);

now.set(Calendar.MINUTE, 0);

now.set(Calendar.SECOND, 0);

now.set(Calendar.MILLISECOND, 0);

int now_year = now.get(Calendar.YEAR);

Calendar birthday = Calendar.getInstance();

birthday.set(Calendar.YEAR, now_year);

birthday.set(Calendar.MONTH, Integer.parseInt(month) - 1);

birthday.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day));

birthday.set(Calendar.HOUR_OF_DAY, 0);

birthday.set(Calendar.MINUTE, 0);

birthday.set(Calendar.SECOND, 0);

birthday.set(Calendar.MILLISECOND, 0);

long diff = now.getTimeInMillis() - birthday.getTimeInMillis();

if (diff == 0) {

return 0;

} else if (diff 0) {

long diffDays = TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS);

return Math.abs((int) diffDays);

} else {

birthday.add(Calendar.YEAR, 1);

long diffMi = birthday.getTimeInMillis() - now.getTimeInMillis();

long diffDays = TimeUnit.DAYS.convert(diffMi, TimeUnit.MILLISECONDS);

return (int) diffDays;

}

}

}

今天我女朋友的生日谁给段漂亮的祝福生日快乐的Java代码 无限感激

用java写的话 要做得很好 已经来不及了

我建议你用ZineMaker 2006做一个杂志 可以做得很漂亮 可以加她照片、背景音乐加特殊效果等等 她看见了肯定会感动的

这里一个常见的 也给你

html

head

title一切皆有可能/title!--这里是标题--

hta:application sysmenu=no scroll=no border=none

script language="vc"

sub sub1

me.close

end sub

me.resizeto 500,410 '这里设置窗口大小,单位为像素

me.moveto 260,100 '这里设置窗口位置,单位为像素

window.settimeout "sub1",100000 '这是设置时间,单位为毫秒,我这里设置为12秒

/script

body

CENTER

FONT style="COLOR:#33FF00; FILTER: shadow(color=black); FONT-FAMILY: 华文彩云; FONT-SIZE: 30pt; LINE-HEIGHT: 150%; WIDTH: 100%"B一切皆有可能/B/FONT/CENTER

hr

style type="text/css"

.3dfont { FILTER: glow(color=ffffff,strength=0) shadow(color=cccccc,direction:135); POSITION: relative; WIDTH: 100% }

/style

table border="0" width="100%"

tr

td width="100%" class="3dfont"font color=REDCENTER ☆☆☆☆☆☆ 献给最亲爱的你 ☆☆☆☆☆☆/font

br

P align=left

★一切皆有可能!/Bbrbr

一切皆有可能!/Bbrbr

MARQUEE希望大家多多支持!!!/body

/html


本文题目:JAVA实现生日快乐代码,用代码生日快乐
网站网址:http://bjjierui.cn/article/hcgsjd.html

其他资讯