import java.io.IOException;
import java.io.InputStream;
public class IsTriangle {public static void main(String[] args){
InputStream i=System.in;
try {
System.out.println(i.read());
} catch (IOException e) {
e.printStackTrace();
}}
}
输入30 输出51
import java.io.InputStream;
public class IsTriangle {public static void main(String[] args){
InputStream i=System.in;
try {
System.out.println(i.read());
} catch (IOException e) {
e.printStackTrace();
}}
}
输入30 输出51
import java.io.InputStream;public class InputStreamTest { public static void main(String[] args) {
InputStream is = System.in;
byte[] b = new byte[1024];
try {
int size = is.read(b);
System.out.println(new String(b,0,size));
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}}
import java.util.Scanner;
public class IsTriangle {
public void CheckInt(int i){
if(i<=1||i>=100){
System.out.println(i+"的取值不在允许取值的范围内");
return;
}
}
public void CheckTriangle(int a,int b,int c){
if(a<b+c&&b<a+c&&c<a+c){
if(a==b&&b==c){
System.out.println("等边三角形");
return;
}
if(a==b||b==c||a==c){
System.out.println("等腰三角形");
return;
}
System.out.println("不等边三角形");
}
}
public static void main(String[] args){
//Scanner s=new Scanner(System.in);
//int a=s.nextInt();
//int b=s.nextInt();
/int c=s.nextInt();
IsTriangle iT=new IsTriangle();
iT.CheckInt(a);
iT.CheckInt(b);
iT.CheckInt(c);
iT.CheckTriangle(a,b,c);
System.out.println(System.in);
}
}
*//*
import java.io.IOException;
import java.io.InputStream;
public class IsTriangle {public static void main(String[] args){
InputStream i=System.in;
try {
System.out.println(i.read());
} catch (IOException e) {
e.printStackTrace();
}}
}*/
/*import java.io.IOException;
import java.io.InputStream;public class IsTriangle { public static void main(String[] args) {
InputStream is = System.in;
byte[] b = new byte[1024];
try {
int size = is.read(b);
System.out.println(new String(b,0,size));
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}}*/
import java.io.IOException;
import java.io.InputStream;public class InputStreamTest { public static void main(String[] args) {
InputStream is = System.in;
byte[] b = new byte[1024];
try {
int size = is.read(b);//读入缓冲区的总字节数,如果由于流末尾已到达而不再有数据,则返回 -1
System.out.println(new String(b,0,size));
/* public String(byte[] bytes,
int offset,
int length)构造一个新的 String,方法是使用指定的字符集解码字节的指定子数组。新的 String 的长度是一个字符集函数,因此不能等于该子数组的长度。
当给定字节在给定字符集中无效的情况下,该构造方法无指定的行为。当需要进一步控制解码过程时,应使用 CharsetDecoder 类。
参数:
bytes - 要解码为字符的字节
offset - 要解码的首字节的索引
length - 要解码的字节数
抛出:
IndexOutOfBoundsException - 如果 offset 和 length 参数索引字符超出 bytes 数组的范围*/
System.out.println(b[0]);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}}
import java.io.InputStream;public class InputStreamTest { public static void main(String[] args) {
InputStream is = System.in;
byte[] b = new byte[1024];
try {
int size = is.read(b);//读入缓冲区的总字节数,如果由于流末尾已到达而不再有数据,则返回 -1
System.out.println(new String(b,0,size));
/* public String(byte[] bytes,
int offset,
int length)构造一个新的 String,方法是使用指定的字符集解码字节的指定子数组。新的 String 的长度是一个字符集函数,因此不能等于该子数组的长度。
当给定字节在给定字符集中无效的情况下,该构造方法无指定的行为。当需要进一步控制解码过程时,应使用 CharsetDecoder 类。
参数:
bytes - 要解码为字符的字节
offset - 要解码的首字节的索引
length - 要解码的字节数
抛出:
IndexOutOfBoundsException - 如果 offset 和 length 参数索引字符超出 bytes 数组的范围*/
System.out.println(b[0]);
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}}