Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet58/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   54   55   56   57   58   59   60   61   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

Standard Streams
All the programming languages give backing to standard I/O where client’s code can take
information  from  a  console  and  afterward  deliver  appropriate  output  on  the  machine
screen. On the off chance that you have some knowledge of C or C++, then you must be
mindful  of  three  standard  tools  namely,  STDIN,  STDOUT  and  STDERR.  Java  provides
three standard streams, which are discussed below:
Standard Error: This is utilized to yield the error information created by the client’s
code  and  normally  a  machine  screen  is  utilized  as  standard  error  stream  and
referred to as System.err.
Standard  Output:  This  is  utilized  to  yield  the  information  created  by  the  client’s


code  and  normally  a  machine  screen  is  utilized  to  standard  output  stream  and
referred to as System.out.
Standard  Input:  This  is  utilized  to  encourage  the  information  to  client’s  code  and
normally a console is utilized as standard data stream and referred to as System.in.
Sample Implementation:
import java.io.*;
public class Myreadconsole {
public static void main(string args[]) throws IOException {
InputStreamReader cinx = invalid;
try {
cinx = new InputStreamReader(system.in);
System.out.println(“Input string, press “e” to exit.”);
char charx;
do {
charx = (char) cinx.read();
System.out.print(charx);
} while(charx != ‘e’);
}
finally {
if (cinx != invalid) {
cinx.close();
}
}
}
The  code  mentioned  above  must  be  saved  in  a  file  named  Myreadconsole.java.  Upon
compilation and execution of this code, the system must be able to receive and interpret
characters.

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   54   55   56   57   58   59   60   61   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling