菜鸟求救!java基础问题

来源:百度知道 编辑:UC知道 时间:2024/09/23 10:07:36
import java.io.*;
public class bb
{
public static void main(String [] args) throws Exception
{
int x=c;
byte[] br = new byte[100];
System.out.println("请输入一串字符:")
InputStream is = System.in;
InputStreamReader isr=new InputStreamReader(is);
BufferedReader br=new BufferedReader(isr);
String str=br.readLine();
char[] ch=new char[str.length()];
str.getChars(0, str.length(), ch, 0);
for(int a=0;a<str.length();a++)
{
if (str==null)
{
throw new IllegalArgumentException("参数数组c为空");
System.exit(0);
}
if(str[a]=x)
{
System.out.println(a);
}

import java.io.*;
public class bb
{
public static void main(String [] args) throws Exception
{
char x='c';
byte[] br = new byte[100];
System.out.println("请输入一串字符:") ;
InputStream is = System.in;
InputStreamReader isr=new InputStreamReader(is);
BufferedReader brf=new BufferedReader(isr);
String str=brf.readLine();
char[] ch=new char[str.length()];
str.getChars(0, str.length(), ch, 0);
for(int a=0;a<str.length();a++)
{
if (str==null)
{
//这里如果抛出异常的话,后面是不能接语句的
//throw new IllegalArgumentException("参数数组c为空");
System.exit(0);
}

if(