📄 test_001.java
字号:
import java.io.*;
import com.sun.xml.internal.ws.wsdl.writer.document.http.Address;
public class Test_001 {
/**
* @param args
*/
public static double readDouble()
{
try
{
return Double.valueOf(readString().trim()).doubleValue();
}
catch (NumberFormatException ne)
{
System.err.println("Console.readDouble: Not a double . . .");
System.exit(- 1);
return 9.09;
}
}
public static int readInt()
{
try
{
return Integer.valueOf(readString().trim()).intValue();
}
catch (NumberFormatException ne)
{
System.err.println("Console.readInt: Not an integer . . .");
System.exit(- 1);
return - 1;
}
}
public static String readString()
{
String string = new String();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
try
{
string = in.readLine();
}
catch (IOException e)
{
System.out.println("Console.readString: Unknown error . . .");
System.exit(-1);
}
return string;
}
public static String replace(String s, String old, String with)
{
String newString = " _";
String remainder = s;
if (remainder.indexOf(old) > 0)
{
int start = remainder.indexOf(old);
int end = start + old.length() + 1;
newString = remainder.substring(0,start) + with;
remainder = remainder.substring(end, remainder.length());
}
return newString + remainder;
}
public static int convertToInt(String s)
{
Integer I = Integer.valueOf(s);
return I.intValue();
}
class Address
{
String firstName;
String lastName;
String email;
Address(String _firstName, String _lastName, String _email)
{
firstName = _firstName;
lastName = _lastName;
email = _email;
}
void showAddress()
{
System.out.println(lastName + ", " + firstName + " (" + email + ")");
}
}
class Parents
{
String LABELS[] = {"father", "mother"};
Address parents[] = new Address[2];
Parents()
{
for (int i = 0; i < parents.length; i ++)
{
System.out.print("df");
}
}
protected void finalize()
{
//super.finalize();
for (int i = 0; i < parents.length; i ++)
parents[i] = null;
parents = null;
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
//System.out.println("google");
/*double A[] = new double [10];
for (int j = 0; j < A.length; j ++)
A[j] = j*j - j + 10;
for (int i = 0; i < A.length; i ++)
System.out.println(A[i]);*/
/*
System.out.print("Enter integer: ");
int i = Test_001.readInt();
System.out.print("Enter double: ");
double x = Test_001.readDouble();
System.out.println("Integer entered: " + i);
System.out.println("Double entered: " + x);
*/
/*
String str_s = "landerance";
String str_old = "der";
String str_with = "kit";
replace(str_s, str_old, str_with);
System.out.println(str_s);
*/
/*
if (args.length > 0)
System.out.println(convertToInt(args[0]));
else
System.out.println("Nothing to convert ");
*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -