zoukankan      html  css  js  c++  java
  • 140201129-贾杰峰

    p173-6

    class Date{
    private String info;
    private String identify;
    public Date(String info)
    {
    this.info=info;
    this.identify=identify;
    }
    public String getInfo() {
    return info;
    }
    public void setInfo(String info) {
    this.info = info;
    }
    public String getIdentify() {
    return identify;
    }
    public void setIdentify(String identify) {
    this.identify = identify;
    }
    }
    public class SixWork {
    public static void main(String[] args) {
    Date infu=new Date("Java技术学习班20070326 MLDN 老师");
    System.out.println("日期为:"+infu.getInfo().substring(9,17));
    String str1="MLDN JAVA";
    String newstr1=str1.replace("JAVA", "J2EE");
    System.out.println("替换为:"+newstr1);
    System.out.println("取出第8个字符为:"+infu.getInfo().charAt(7));
    String str2=infu.getInfo().replaceAll("0", "");
    System.out.println("清除所有0为:"+str2);
    String str3=infu.getInfo().replaceAll(" ", "");
    System.out.println("清除所有空格为"+str3);
    infu.setIdentify("110225148605922654");
    char b[]=infu.getIdentify().toCharArray();
    for(int j=b.length-8;j<b.length;j++)
    {
    System.out.print(+b[j]);
    }
    }
    }

    9

    class Book{
    private String name;
    private static int number=0;
    private int money;
    private static int ceshu;
    private String count;
    public Book(String name,int number,int money,int ceshu)
    {

    this.name=name;
    this.number=number;
    this.money=money;
    this.ceshu=ceshu;

    this.count=""+number;
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    public static int getNumber() {
    return number;
    }
    public static void setNumber(int number) {
    Book.number = number;
    }
    public int getMoney() {
    return money;
    }
    public void setMoney(int money) {
    this.money = money;
    }
    public static int getCeshu() {
    return ceshu;
    }
    public static void setCeshu(int ceshu) {
    Book.ceshu = ceshu;
    }
    public String information()
    {
    return "书名为:"+this.name+" 编号为:"+this.count+" 价格为:"+this.money+" 册数为:"+this.ceshu;
    }
    }
    public class NinethWork {
    public static void main(String[] args) {
    Book book[]={
    new Book("zs",1,12,46),new Book("ls",2,32,80),new Book("tbw",3,42,95)
    };
    int sum=0;
    for(int j=0;j<book.length;j++)
    {

    sum=sum+book[j].getCeshu();
    System.out.println(book[j].information());
    }
    System.out.print("总册数为:"+sum);
    }

    }

  • 相关阅读:
    Vuecli3项目引入网页视频流媒体播放器EasyPlayer.JS报videojs not definde错误如何解决?
    穷人和富人的区别
    如何使用PCATTCP测试局域网传输速度
    DirectFB同时显示到X11和VNC上
    使用Openssl生成CA及签发证书方法
    内存泄漏定位
    关于在C++开发的项目中引用后缀名为.c文件的一句话提醒
    在Win32下建立GTK开发环境
    GTK/DFB中的WaitCursor
    GTK+/DFB优化
  • 原文地址:https://www.cnblogs.com/jiajiefeng/p/5343393.html
Copyright © 2011-2022 走看看