public static void main(String[] args){
String firstString="This is";
String secondString="This is";
if(firstString==null & secondString==null){
System.out.println("①firstString and secondString are equal");
}else if(firstString!=null & firstString.equals(secondString)){
System.out.println("①firstString and secondString are equal");
}else{
System.out.println("①firstString and secondString are not equal");
}
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("Program ends!;/Determine whether the input is q
break.println(result);
}
}
It should be very detailed;
}
System.io.InputStreamReader;
/:"!"
while (true) {
String read = null;i")) {/Please enter a character; = n; j
result = result * 3;
}
System.out.println(result);
}
if (read.equals(".BufferedReader;
import java.io.println ("/Create an input stream, accept a character input from the console, and the three characters q are processed accordingly; j) {
result = result * j; determine whether the input is p
for (int j = 1;
double result = 1;)) {//);/Judge whether the input is 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;/This program is only for 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("Enter a set of data:");
String line = sc.nextLine().trim();
if(!line.matches("^\\d (\\s \\d )*$"")){
System.out.print("Input error,");
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;
}
}
The above is the detailed content of Write a simple JAVA program!. For more information, please follow other related articles on the PHP Chinese website!