if(Character.isLowerCase(a[n])){
a[n]=Character.toUpperCase(a[n]); } } } } }
运算结果: D:\\java>java Stg
连接后的字符:wo de ming zi shi LI ZHI DONG 大小写转换后的字符:WO DE MING ZI SHI li zhi dong
或者简单点程序代码: public class Stg{
public static void main(String args[]){
s3=new String(a);
System.out.println(\大小写转换后的字符:\ else
if(Character.isUpperCase(a[n])){ a[n]=Character.toLowerCase(a[n]);
String s1=new String(\ String s2=new String(\ String s3=s1.concat(s2);
System.out.println(\连接后的字符:\
System.out.println(\小写转换大写:\ System.out.println(\大写转换小写:\} }
程序运行结果: D:\\java>java Stg
连接后的字符:wo de ming zi shi LI ZHI DONG 小写转换大写:WO DE MING ZI SHI 大写转换小写:li zhi dong 2、 程序代码:
public class DingWei{
public static void main(String args[]){ String s=new String(\ char a=s.charAt(0);
char b=s.charAt(s.length()-1);
System.out.println(\字符串的第一个字符是:\ System.out.println(\字符串的最后一个字符是:\ }
} 程序结果:
D:\\java>java DingWei s字符串的第一个字符是:w
s字符串的最后一个字符是:u
3、
程序代码:
import java.util.Scanner;
public class RiLi{
public static void main(String args[]){ int dayofyears=0; int dayofmonth=0;
Scanner input=new Scanner(System.in); System.out.print(\请输入年份:\ int year=input.nextInt(); System.out.print(\请输入月份:\ int month=input.nextInt(); for(int n=0001;nif(((n%4==0)&&(n0!=0))||(n@0==0)){ } else{ }
dayofyears=dayofyears+365; dayofyears=dayofyears+366;
}