public static void main(String[] args){
String firstString="This is";
String secondString="This is";
if(firstString==null & secondString==null){
System.out.println("①firstString 与 secondString 相等");
}else if(firstString!=null & firstString.equals(secondString)){
System.out.println("①firstString 与 secondString 相等");
}else{
System.out.println("①firstString 与 secondString 不相等");
}
String str = firstString + "his father";
System.out.println("②"+str);
System.out.println("③"+str.replaceAll("i", "z"));
}
println("
BufferedReader distream = new BufferedReader(new InputStreamReader(
System.IOException;)!!
try {
System.out,ppackage com.ascent.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (read.equals("程序结束!;/判断输入的是否为q
break.println(result);
}
}
应该很详细了;
}
System.io.InputStreamReader;
/:"!"
while (true) {
String read = null;i")) {/请输入一个字符;= n; j
result = result * 3;
}
System.out.println(result);
}
if (read.equals(".BufferedReader;
import java.io.println("/创建一个输入流,接受从从控制台输入的一个字符,q三个字符进行了相应的处理; j++) {
result = result * j;判断输入的是否为p
for (int j = 1;
double result = 1;)) {//);/判断输入的是否为i
for (int j = 1; j <.out;
}
System;q"))/!!
public class TestLession {
public static void main(String[] args) {
int n= 10.out.in));/.test;
import java.io;
import java;
read = distream;/本程序只对i!!;
}
if (read.equals("p"
import java.util.*;
public class Tester{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(true){
System.out.print("输入一组数据:");
String line = sc.nextLine().trim();
if(!line.matches("^\d+(\s+\d+)*$")){
System.out.print("输入错误, ");
continue;
}
String[] arr = line.split("\s+");
System.out.println(Arrays.toString(arr));
sc.close();
break;
}
}
}
public class Search {
public static final int[][] array ={
{8,2,3,4,5},
{7,6,5,8,8},
{6,4,5,7,10}
};
public static void main(String[] args) {
for(int i=0;i
int minCol = getrowMin(i);
if(iscolMin(minCol,i)){
System.out.println("array["+i+"]["+minCol+"]");
}
}
}
public static int getrowMin(int rowNo){
int min=array[rowNo][0];
int col=0;
for(int i=1;i
if(array[rowNo][i] min=array[rowNo][i]; col=i; } } return col; } public static boolean iscolMin(int colNo,int rowNo){ for(int i=0;i
if(array[i][colNo]
} return true; } }
以上是编写一个JAVA简单的程序!的详细内容。更多信息请关注PHP中文网其他相关文章!