惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

PCI Perspectives
PCI Perspectives
AI
AI
L
LINUX DO - 最新话题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
T
Troy Hunt's Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Forbes - Security
Forbes - Security
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
O
OpenAI News
D
DataBreaches.Net
S
Secure Thoughts
SecWiki News
SecWiki News
L
LangChain Blog
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Martin Fowler
Martin Fowler
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
有赞技术团队
有赞技术团队
The Last Watchdog
The Last Watchdog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
宝玉的分享
宝玉的分享
N
News | PayPal Newsroom
博客园 - 聂微东
TaoSecurity Blog
TaoSecurity Blog
Cloudbric
Cloudbric
Blog — PlanetScale
Blog — PlanetScale
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
量子位
T
Threatpost
Security Latest
Security Latest
P
Privacy & Cybersecurity Law Blog
GbyAI
GbyAI
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
S
Security @ Cisco Blogs
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tailwind CSS Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
L
LINUX DO - 热门话题

博客园 - 空气

没有不可能的事情 迅景如梭,旧游似梦,烟水程何限 [转]一些web开发中常用的、做成cs文件的js代码 数类 MBTI职业性格测试 Which Programming Lanuguage Are You? 如何解释内存中的内容 好久没来了。。。 第七章: 封装 - 空气 - 博客园 C/C++中的内存管理 经典正则表达式 二叉树的显示 软件工厂的考试题目程序 第六章: 字符串 测试-通过Word 2007发布Blog 第五章: 数组 第四章: 从 autoboxing 和 unboxing 认识对象 1. 让自己习惯C++ 0. 序
第三章: 语法入门
空气 · 2006-12-01 · via 博客园 - 空气

这一章讲的是基本JAVA语法,真的好"基本"...

一次讨论的时候一个师姐说,其实C#就是抄JAVA的.如果这句话成立的话,那么JAVA又何尝不是抄C++的呢?其实我觉得虽然他们有很多相同之处,但"抄袭"二字还是言重了.相对于C语言,JAVA是晚辈,而相对于JAVA,C#又变成了后辈.做为一个新兴事物,借鉴前人的经验本就无可厚非,更何况他们都在前人的基础上进行了大量的革新.正是这些革新,给予了他们新的生命力,让越来越多的人支持他们.

说回这一章的内容...

关于数据类型,运算符和流程控制的相关内容,C系列的语言都大同小异,所以这一章重点看JAVA的输入输出.

在 J2SE5.0 的版本中可以直接使用和C语言一样的 printf 函数.非常方便.但我的版本不够高.要用 System.out.print(或println).

标准输入对象一次只能读取一个字节的数据,所以一般来说不会用到.
书中提到的输入有两种方式,一种是利用scanner类,不常用.常用的是第二种, BufferedReader 类.具体用法如下.

import java.io.*;

public class myPro 
{
    
public static void main(String[] args) throws IOException 
    
{
        BufferedReader br 
= new BufferedReader(new InputStreamReader(System.in));
        System.out.print(
"请输入一列文字, 可包括空白: ");
        String text 
= br.readLine();
        System.out.println(
"您输入的文字: " + text);        
    }

}

另外可以将 System 类中的对象 out 的输出重定向.如
java HelloJava > HelloJavaResult.txt

标准错误输出串 err 与 out的不同是,err总是显示在显示设备上,而不会被重新定位