java中的foreach用法
import java.util.*;
public class ForeachExample {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random();
int[] x = new int[10];
for (int i = 0; i < x.length; i++) {
x[i] = r.nextInt(100);
}
// foreach的使用
for (int y : x) {
System.out.print(y + " ");
}
System.out.println();
// 另一种打印数组的方式
System.out.println(Arrays.toString(x));
for (char c : "I am a good girl!".toCharArray())
System.out.print(c + " ");
}
}
相关文档:
java exception 解决方案 - 我的异常网|异常|exception 730 - org.hibernate.LazyInitializationException:could not initialize proxy 731 - 警告: Error setting value 732 - override and commit 733 - Building workspace has encountered a problem. Errors during build 734 - Could not open the editor: An ......
从架构设计方面考虑,很多系统采用了 Java Bridge把php和JAVA技术结合起来,利用PHP的快速响应和JAVA的数据持久化能力,能很大程度上能提高系统性能。这两篇文章将详细的介绍Project Zero、WebSphere sMash 和 PHP 的整合技术
Project Zero、WebSphere sMash 和 PHP 入门
http://www.ibm.com/developerworks/cn/web/wa- ......
源代码:
import com.sap.mw.jco.*;
public class control extends Object
{
public static void main (String str[])
{
control control=new control();
}
int count;
JCO.Client mConnection;
JCO.Repository mRepository;
String[] SAPInterfaces;
public control()
{
try {
& ......
1.首先创建一个工程随便命名。
2.创建一个类命名为Reg.
3.执行代码
4.输入注册的姓名,显示栏目会出现please input register name:,只要输入英文名然后回车,注册码就出来了。把姓名和注册码像:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public clas ......