易截截图软件、单文件、免安装、纯绿色、仅160KB

基础 JAVA程序


1.编程界最著名的一句话“Hello world!”,任何一个程序员起步时必遇的语句
public class HelloWorld {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("Hello World!");
}
}
2.根据提示输入两个整数,输出整数的和,最基础的程序,初学者需懂得Scanner的用法
import java.util.Scanner;
public class AddTwoInteger {
public static void main(String[] args) {
// TODO Auto-generated method stub
    int integer1;
    int integer2;
    int sum;
Scanner input=new Scanner(System.in);
System.out.print("Enter first integer:");
      integer1=input.nextInt();
System.out.print("Enter second integer:");
      integer2=input.nextInt(); 
      sum=integer1+integer2;
 System.out.printf("%d",sum);      
      
}
}
3.判断大小的程序,这个程序也没啥可说的,唯一提醒的是:在判断大小的时候(相等的情况)不要把“==“错写成=,这是最常见的错误。
import java.util.Scanner;
public class Comparision {

public static void main(String[] args) {
// TODO Auto-generated method stub
    int integer1;
    int integer2;
   
Scanner input=new Scanner(System.in);
System.out.print("Enter first integer:");
      integer1=input.nextInt();
System.out.print("Enter second integer:");
      integer2=input.nextInt(); 
      if(integer1>integer2) &nb


相关文档:

java 缓存框架java caching system使用示例

  要使用java caching system,需要下面这几个包:jcs.jar,concurrent.jar,commons-logging.jar, commons-lang.jar,commons-collection.jar这几个包,在java工程里面,
首先新建一个使用jcs的配置文件:cache.ccf,文件名不能改。
# DEFAULT CACHE REGION
# sets the default aux value for any non configured ca ......

java文件过滤器的使用

java文件过滤器的使用代码如下:
测试代码:package file;
import java.io.File;
public class fileFilter {
 public static void main(String[] args) {
  File file = new File("d:\\");//设置文件路径
  for (File fileList : file.listFiles(new file.MyFileFilter())) {
   ......

Java的技术分类


目前JAVA2有三个版本:J2EE(企业版)、J2SE(标准版)、J2ME(微型版) 
1、J2SE(JAVA2 Standart Edition) 
JAVA2标准版 支持所有JAVA标准规范中所定义的核心类函数库和所有的JAVA基本类别。J2SE定位在客户端程序的应用上。 
2、J2EE(JAVA2 Enterprise Edition) 
......

刀石头布游戏 java版

import java.util.Scanner;
public class Game{
  void welcome(){
   println("欢迎来到剪刀石头布游戏");
  }
 Choice getUserChoice(){
  println("请选择\t[1]剪刀\t[2]石头\t[3]布");
  Scanner sc= new Scanner(System.in);
  int userCh ......

java编码转换

常见的JAVA程序包括以下类别:
*直接在console上运行的类(包括可视化界面的类)
*JSP代码类(注:JSP是Servlets类的变型)
*Servelets类
*EJB类
*其它不可以直接运行的支持类
 
这些类文件中,都有可能含有中文字符串,并且常用前三类JAVA程序和用户直接交互,用于输出和输入字符,如:在JSP和Servlet中得到客户 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号