

import java.io.*;

class examples {
// START main0
// pass on IOException generated by read()
public static String getLine() throws IOException {
    StringBuffer buf = new StringBuffer(80);
    int c;
    while ((c = System.in.read()) != -1) {
	char ch = (char) c;
	if (ch == '\n')
	    break;
	buf.append(ch);
    }
    return (buf.toString());
}
// END main0

public static void main(String[] args) {
// START main
try {
    int a[] = new int[2];
    a[4]= 3;
} catch (Throwable e) {
    System.err.println("exception msg: " + e.getMessage());
    System.err.println("exception string: " + e.toString());
    e.printStackTrace();
}
// END main

try {
// START fill
int a = 0, b = 0, c = 0;
// UNCOM ...
try {
    a = b / c;
} catch(Throwable e) {
    throw e.fillInStackTrace();
}
// END fill
} catch (Throwable e) {
    System.err.println("outside:");
    e.printStackTrace();
}
{
// START print
try {
    Long lobj2 = new Long("1048L576"); // using string
} catch (NumberFormatException e) {
    e.printStackTrace();	// output goes to System.err
    e.printStackTrace(System.out);  // send trace to stdout too
}
// END print
}
{
// START getmsg
try {
    FileInputStream out = new FileInputStream(args[0]);
// UNCOM...
} catch (IOException e) {
    System.err.println("cannot create stream: " + e.getMessage());
}
// END getmsg
}
{
// START tostr
try {
    FileInputStream out = new FileInputStream(args[0]);
// UNCOM...
} catch (IOException e) {
    System.err.println(e.toString());
}
// END tostr
}

/*
// START const
// Implementation of FileInputStream.getFD()
public final FileDescriptor getFD() throws IOException {
    if (fd != null) return fd;
    throw new IOException();
}
// Implementation of FileInputStream constructor
public FileInputStream(String name) throws FileNotFoundException {
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
	security.checkRead(name);
    }
    try {
	fd = new FileDescriptor();
	open(name);
    } catch (IOException e) {
	throw new FileNotFoundException(name);
    }
}
// END const
*/

// START main1
// Must enclose call to getLine() with try/catch
try {
    System.out.println(getLine());
} catch (IOException e) {
    System.err.println(e.toString());
}
// END main1
}
}


