class huiwenshu
public class huiwenshu {public static void main(String[] args) {System.out.println("输入...");Scanner in = new Scanner(System.in);String number = in.next();boolean flag = true;for(int i=0;i<number.trim().length()/2;i++){if(!String.valueOf(number.charAt(i)).equals(String.valueOf(number.charAt(number.trim().length()-i-1)))){flag = false;break;}}if(flag){System.out.println("是滴");}else{System.out.println("no go away");}in.close();}
}
/class ChangeTime
package 时间变换;import java.util.Date;
import java.util.TimeZone;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;public class ChangeTime {public static void main(String[] args) throws ParseException {Date date=new Date();SimpleDateFormat sdf3=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sdf3.setTimeZone(TimeZone.getTimeZone("GMT+8"));System.out.println("beijig"+sdf3.format(date));SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sdf.setTimeZone(TimeZone.getTimeZone("GMT+1"));System.out.println("bali"+sdf.format(date));SimpleDateFormat sdf1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sdf1.setTimeZone(TimeZone.getTimeZone("GMT-4"));System.out.println("niuyue"+sdf1.format(date));}public void getTime(int year,int month,int date,int h,int m){Calendar c = Calendar.getInstance();//设置巴黎的时间c.set(year, month, date, h-7, m);System.out.println("巴黎时间:"+c.get(Calendar.YEAR)+"年"+c.get(Calendar.MONTH)+"月"+c.get(Calendar.DAY_OF_MONTH)+"日"+c.get(Calendar.HOUR_OF_DAY)+"点"+c.get(Calendar.MINUTE)+"分");//设置纽约时间c.set(year, month, date, h-12, m);System.out.println("纽约时间:"+c.get(Calendar.YEAR)+"年"+c.get(Calendar.MONTH)+"月"+c.get(Calendar.DAY_OF_MONTH)+"日"+c.get(Calendar.HOUR_OF_DAY)+"点"+c.get(Calendar.MINUTE)+"分");}}
/class Demo
package 解析邮箱;import java.util.Scanner;public class Demo {public boolean testEmail(){System.out.println("请输入一个邮箱~~~");Scanner sc = new Scanner(System.in);String s = sc.next();if(s.indexOf("@")==-1||s.indexOf(".")==-1){System.out.println("邮箱没有@或.");return false;}if(s.indexOf("@")!=s.lastIndexOf("@")||s.indexOf(".")!=s.lastIndexOf(".")){System.out.println("邮箱中含有多个@或.");return false;}if(s.indexOf("@")>s.indexOf(".")){System.out.println("邮箱中的.出现在@前面");}for (int i = 0; i < s.indexOf("@"); i++) {if((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='A'&&s.charAt(i)<='Z')){}else{System.out.println("用户名含有其他字符");return false;}}return true;}public static void main(String[] args) {Demo d = new Demo();if(d.testEmail()){System.out.println("用户名合法");}else {System.out.println("用户名不合法");}}}