33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
---
|
|
title: キーボードからの入出力
|
|
author: kazu634
|
|
date: 2008-05-20
|
|
url: /2008/05/20/_999/
|
|
wordtwit_post_info:
|
|
- 'O:8:"stdClass":13:{s:6:"manual";b:0;s:11:"tweet_times";i:1;s:5:"delay";i:0;s:7:"enabled";i:1;s:10:"separation";s:2:"60";s:7:"version";s:3:"3.7";s:14:"tweet_template";b:0;s:6:"status";i:2;s:6:"result";a:0:{}s:13:"tweet_counter";i:2;s:13:"tweet_log_ids";a:1:{i:0;i:4029;}s:9:"hash_tags";a:0:{}s:8:"accounts";a:1:{i:0;s:7:"kazu634";}}'
|
|
categories:
|
|
- java
|
|
- Programming
|
|
|
|
---
|
|
<div class="section">
|
|
<pre class="syntax-highlight">
|
|
<span class="synPreProc">import</span> java.io.*;
|
|
<span class="synType">class</span> temp
|
|
{
|
|
<span class="synType">public</span> <span class="synType">static</span> <span class="synType">void</span> main(String args[])
|
|
{
|
|
System.out.println (<span class="synConstant">"文字列を入力してください。"</span>);
|
|
<span class="synStatement">try</span>{
|
|
BufferedReader br =
|
|
<span class="synStatement">new</span> BufferedReader(<span class="synStatement">new</span> InputStreamReader(System.in));
|
|
String str = br.readLine();
|
|
System.out.println (str + <span class="synConstant">"が入力されました。"</span>);
|
|
}
|
|
<span class="synStatement">catch</span>(IOException e){
|
|
System.out.println(<span class="synConstant">"入出力エラーです"</span>);
|
|
}
|
|
}
|
|
}
|
|
</pre>
|
|
</div> |