代码如下: 
//progame:Print a tringle of stars 
import java.io.*; 
public class TringleOfstars 

static BufferedReader keyboard= 
new BufferedReader(new InputStreamReader(System.in)); public static void main(String[]args)throws IOException 

int numberoflines; 
int counter; 
int numberofblanks; System.out.print("Enter the number of star lines (1 to 20)" 
+"to be pront-->"); 
System.out.flush(); 
numberoflines=Integer.parseInt(keyboard.readline()); 
while(numberoflines <0||numberoflines>20); 

System.out.print("number of star lines should be" 
+"between 1 and 20"); 
System.out.print("Enter the number of star lines(1 to 20)to be printed-->"); 
System.out.flush(); 
numberoflines=Integer.parseInt(keyboard.readLine()); 

numberofblanks=30; 
for(counter=1;counter <=numberoflines;counter++) 

printstars(numberofblanks,counter); 
numberofblanks--; 

} public static void printstars(int blanks,int starsinline) 

int count; 
for(count=1;count <=blanks;count++) 
System.out.print(""); 
for(count=1;count <=starsinline;count++) 
System.out.print("*"); 


调试结果: 
D:\mj>javac TringleOfstars.java 
TringleOfstars.java:17: 找不到符号 
符号: 方法 readline() 
位置: 类 java.io.BufferedReader 
                numberoflines=Integer.parseInt(keyboard.readline()); 
                                                      ^ 
1 错误 我是新手,请指点下啊

解决方案 »

  1.   

    BufferedReader这个类里面没有readline方法,L应该大写,是readLine();楼主用的记事本编辑?找个开发工具很快就看出来了……
      

  2.   

    while(numberoflines <0||numberoflines>20); 這句后面多了個分號~~
      

  3.   

    找个IDE ,这些也就不是问题的问题了。
      

  4.   

    用ULTRAEDIT写的,问题已解决,谢谢各位