码迷,mamicode.com
首页 > 其他好文 > 详细

aASs

时间:2021-01-11 11:17:35      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:ott   ati   rgs   new   drive   public   while   对象   round   

public class Beersong {
public static void main (String[] args){
int beernum =99;
String word = "bottle";
while (beernum>0){
if (beernum == 1){
word = "bootle";
}

System.out.print(beernum+""+word+"of beer on the wall");
System.out.println(beernum+""+"of beer");
System.out.println("Take one down.");
System.out.println("passit around.");
beernum = beernum -1;

   if (beernum>0); {
     System.out.println(beernum+""+"of beer on wall");
   }
   {
     System.out.println("No more bottles of beer on the wall");
   }
}
   
}         


}


2.class Books{
String title;
String author;
}
class BookTestDrive {
public static void main(String args[]){
Books[] myBooks = new Books[3];
int x = 0;
//创建books对象
myBooks[0]=new Books();
myBooks[1]=new Books();
myBooks[2]=new Books();

myBooks[0].title="The Grapes of Java";
myBooks[1].title="The Java Gatsby";
myBooks[2].title="The Java Cookbook";

myBooks[0].author="bob";
myBooks[1].author="sue";
myBooks[2].author="ian";

while(x<3){
System.out.println(myBooks[x].title);
System.out.println("by");
System.out.println(myBooks[x].author);
x=x+1;
}
}


}

aASs

标签:ott   ati   rgs   new   drive   public   while   对象   round   

原文地址:https://www.cnblogs.com/zwq023/p/14253389.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!