[Java] writes an HTML program through the console and saves

Source: Internet
Author: User

 PackageTest.stream;ImportJava.io.BufferedReader;ImportJava.io.BufferedWriter;ImportJava.io.FileWriter;Importjava.io.IOException;ImportJava.io.InputStreamReader;ImportJava.io.PrintWriter;/*** Write an HTML program from the console and output *@authorFrost.yen * @e-mail [email protected] * @date April 13, 2016*/ Public classtesthtml { Public Static voidMain (string[] args) {bufferedreader br=NULL; PrintWriter out=NULL; Try{br=NewBufferedReader (NewInputStreamReader (system.in)); out=NewPrintWriter (NewBufferedWriter (NewFileWriter ("E:\\java\\examples\\to learn\\src\\test\\stream\\test.html"))); String Str=NULL;  while(str = br.readline ())! =NULL){                if(Str.equals ("Exit") {System.out.println ("Thank You");  Break;            } out.println (str); }        } Catch(IOException e) {e.printstacktrace (); }finally {            Try {                if(br!=NULL) Br.close (); } Catch(IOException e) {e.printstacktrace (); }                        Try {                if(out!=NULL) Out.close (); } Catch(Exception e) {e.printstacktrace (); }        }            }}

After running in console input

<body>
<marquee></body>
Exit

Enter

You can generate test.html

[Java] writes an HTML program through the console and saves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.