System.out.print();与System.out.println(); 的区别

System.out.print(); 与 System.out.println();

前者输出不换行,比如:
System.out.print("a");
System.out.print("b");
结果:
ab

后者输出后换行,比如:
System.out.println("a");
System.out.println("b");
结果:
a
b

print后加了ln。 ln的意思就是打印完内容后自动回车因此有了上面:输出后换行的效果

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
package com.tydic.common.utils; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; /* * AES加解密算法 * * @author jueyue * 加密用的Key 可以用26个字母和数字组成,最好不要用保留字符,虽然不会错,至于怎么裁决,个人看情况而定 此处使用AES-128-CBC加密模式,key需要为16位。 也是使用0102030405060708 */ public class AES { // 加密 public static String Encrypt(String sSrc, String sKey) throws Exception { if (sKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (sKey.length() != 16) { System.out.print("Key长度不是16位"); return null; } byte[] raw = sKey.getBytes(); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//"算法/模式/补码方式" IvParameterSpec iv = new IvParameterSpec("0102030405060708".getBytes());//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); byte[] encrypted = cipher.doFinal(sSrc.getBytes()); return Base64.encodeBase64String(encrypted);//此处使用BAES64做转码功能,同时能起到2次加密的作用。 } // 解密 public static String Decrypt(String sSrc, String sKey) throws Exception { try { // 判断Key是否正确 if (sKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (sKey.length() != 16) { System.out.print("Key长度不是16位"); return null; } byte[] raw = sKey.getBytes("ASCII"); SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher ciphe
package com hmm test820; import java util Scanner; public class SMS { public SMS { } public Student[] stu new Student[10]; public void add Student[] stu Student s { System out println "增加一个学生 " ; System out println Student count ; Student count++; this stu[Student count 1] s; } 删除操作 public void delete Student[] stu String id { int index 0; for int i 0;i<Student count;i++ { if id equals stu[i] id { index i; } } Student count ; System out println Student count ; for int i index;i<Student count;i++ { stu[i] stu[i+1]; } } 修改学生信息 public void update Student[]stu String id String name String age String job { System out println "修改学生信息 " ; for int i 0;i<Student count;i++ { if id equals stu[i] id { this stu[i] name name; this stu[i] age age; this stu[i] job job; } } } 查看单个学生信息 public void query Student[]stu String id { System out println "查看单个学生信息 " ; for int i 0;i<Student count;i++ { if id equals stu[i] id { System out println stu[i] id+" t t"+stu[i] name+" t t"+stu[i] age+" t t"+stu[i] job ; } } } 查看学生信息 public void display Student[]stu { for int i 0;i<Student count;i++ { System out print stu[i] id+" t t"+stu[i] name+" t t"+stu[i] age+" t t"+stu[i] job ; System out println ; } } 界面显示部分 登录界面首页显示 public static void print1 { System out println " n n t t欢迎使用学生信息管理系统2 0版 n" ; System out println " n n" ; System out println " t t t t1 登录系统 n n" ; System out println " t t t t2 退出 n n" ; System out println " n n" ; System out print "请选择 请输入数字:" ; } 成功登录后显示部分 public static void print2 { System out println "欢迎使用学生信息管理系统2 0版" ; System out println " " ; System out println " t t t t1 查看当前学生信息" ; System out println " t t t t2 添加学生信息" ; System out println " t t t t3 修改学生信息" ; System out println " t t t t4 查询学生信息" ; System out println " t t t t5 删除学生信息" ; System out println " t t t t6 退出" ; System out println " " ; } public static void printmessage { System out println "请输入学号 姓名 年龄 职位:" ; } public static void printid { System out println "请输入学号:" ; } public static void printnext { System out print "请继续选择您的操作(输入0返回上一菜单):" ; } public static void printlogin { System out print "请输入登录账号:" ; } public static void printps { System out print "请输入密码:" ; } public static String message { Scanner s new Scanner System in ; String str s next ; return str; } public static void printerror { System out println "input error" ; } public static int inputcount { Scanner s new Scanner System in ; int count s nextInt ; return count; } public static void main String[] args { SMS sms new SMS ; Student s new Student "001" "23" "32" "323" ; boolean flag1 true; while flag1 { print1 ; switch inputcount { case 1: { Student s new Student ; printlogin ; String login message ; printps ; String pw message ; print2 ; if login equals "login" &&pw equals "1" { print2 ; printnext ; boolean flag2 true; while flag2 { switch inputcount { case 1: { sms display sms stu ; printnext ; break; } case 2: { printmessage ; s id message ; s name message ; s age message ; s job message ; s new Student s id s name s age s job ; sms add sms stu s ; printnext ; break; } case 3: { printmessage ; s id message ; s name message ; s age message ; s job message ; s new Student s id s name s age s job ; sms update sms stu s id s name s age s job ; printnext ; break; } case 4: { printid ; s id message ; sms query Student[]stu String id ; printnext ; break; } case 5: { printid ; s id message ; sms delete sms stu s id ; printnext ; break; } case 6: { flag1 false; break; } default: { printerror ; break; } } } } break; } case 2: flag1 false; break; default: printerror ; break; } } } }">package com hmm test820; import java util Scanner; public class SMS { public SMS { } public Student[] stu new Student[10]; public void add Student[] stu Student s { System out println "增加一个学生 " ; System out println Student count ; Student count++; t [更多]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值