摘要: import java.util.Scanner; /** *Scanner演示 */public class ScannerDemo{public static void main(String[] args){ //使用Scanner工具类,来通过控制台接收信息Scanner sc = new ... 阅读全文
posted @ 2014-09-14 23:44 fantasy12436109 阅读(97) 评论(0) 推荐(0) 编辑
摘要: /***数据类型演示*/public class DataTypeDemo{public static void main(String[] args){//直接赋予的值,称为字面量//byte b = 128;long l = 123L;char c = '中';// ASCII(0-127) u... 阅读全文
posted @ 2014-09-14 23:37 fantasy12436109 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 2.数据类型 基本类型: 整型: byte字节型 8位(bit) -2^7~2^7-1(-128~127) 0000 0000 short短整型 16位 -2^15~2^15-1(-32768~32767) int整型 32位 -2^31~2^31-1 (大约为21亿) long长整型 64位 -2... 阅读全文
posted @ 2014-09-14 23:14 fantasy12436109 阅读(101) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2014-09-14 23:12 fantasy12436109 阅读(5) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;import java.util.Random;/***跟电脑玩石头剪刀布,需要从控制台输入信息,*然后去判断,然后给予反馈信息*/public class GuessFist{ public static void main(String[]... 阅读全文
posted @ 2014-09-14 23:06 fantasy12436109 阅读(149) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;import java.util.Random;/***跟电脑玩石头剪刀布,需要从控制台输入信息,*然后去判断,然后给予反馈信息*/public class GuessFist{public static void main(String[] arg... 阅读全文
posted @ 2014-09-14 23:04 fantasy12436109 阅读(155) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;import java.util.Random;/***猜数字,使用随机一个0-100的数字,然后用户猜,猜中了就提示猜中了,*否则提示猜大了还是猜小了,给10次机会,10次过后不让猜。*/public class GuessNum{public s... 阅读全文
posted @ 2014-09-14 22:50 fantasy12436109 阅读(276) 评论(0) 推荐(0) 编辑
摘要: import java.util.*;public class GuessNumber { public static void main(String[] args) { int num = new Random().nextInt(100), temp; Sca... 阅读全文
posted @ 2014-09-14 22:23 fantasy12436109 阅读(167) 评论(0) 推荐(0) 编辑
摘要: public class hhh{public static void main(String[]args){ String s1="hkdhskhegoihwhonfdsaaa"; int count=0; for(int x=0;x<s1.length();x++) { if('a'==s1.... 阅读全文
posted @ 2014-09-14 17:36 fantasy12436109 阅读(206) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;public class inputoutar{ public static void main(String[] args) throws NumberFormatException{ Scanner scanner=new Scanner(Sys... 阅读全文
posted @ 2014-09-14 17:32 fantasy12436109 阅读(1464) 评论(0) 推荐(0) 编辑
摘要: public class ish{public static void main(String[]args){String s="call me ishmae";System.out.println(s.charAt(s.length()-1));}} 阅读全文
posted @ 2014-09-14 17:27 fantasy12436109 阅读(252) 评论(0) 推荐(0) 编辑
摘要: import java.awt.*;import javax.swing.*;import java.awt.event.*;public class Login extends JFrame { JTextField usernameTextField; JPasswordField pw... 阅读全文
posted @ 2014-09-14 17:23 fantasy12436109 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 类作为一种应用数据类型,和基本数据类型的变量一样。不同类中存在对象与对象之间的类型转问题,对象的类型转换只能在 具有继承关系的 父类对象-----子类对象 之间进行 子类通常比父类拥有更多的域和方法class Human{ // 父类Human的定义 String name; int age; c... 阅读全文
posted @ 2014-09-14 16:57 fantasy12436109 阅读(219) 评论(0) 推荐(0) 编辑
摘要: public class CreateTwoArray{ public static void main(String []args){ int[][]arr=new int [2][3]; System.out.println("数组arr的初始化后:"); System.out.... 阅读全文
posted @ 2014-09-14 15:46 fantasy12436109 阅读(96) 评论(0) 推荐(0) 编辑
摘要: class parent{ protected static int count=0; public parent() { count++; }}public class child extends paren... 阅读全文
posted @ 2014-09-14 15:41 fantasy12436109 阅读(305) 评论(0) 推荐(0) 编辑
摘要: import java.util.*;public class Arraysort{ public static void main(String[]args){ int[]a={100,34,88,6,39,5}; System.out.println("排序前的数组为:"); System.ou... 阅读全文
posted @ 2014-09-14 15:35 fantasy12436109 阅读(142) 评论(0) 推荐(0) 编辑
摘要: public class ArrayForeach{ public static void main(String []args){ int [][]a={{1,2,3},{4,5,6},{7,8,9},{10,11,12}} ; for(int []row:a) { for(... 阅读全文
posted @ 2014-09-14 15:30 fantasy12436109 阅读(124) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;class Building{ int Floors,Rooms; double Total_area;public: Building( int f,int r,double t) { Floors=f; Roo... 阅读全文
posted @ 2014-09-14 14:07 fantasy12436109 阅读(117) 评论(0) 推荐(0) 编辑
摘要: #include#include#define N 5#define NULL 0#define OK 1#define ERROR 0typedef struct LNode{ int data; struct LNode *next;}LNode,*list;void creatLi... 阅读全文
posted @ 2014-09-14 13:54 fantasy12436109 阅读(172) 评论(0) 推荐(0) 编辑
摘要: import java.util.Scanner;/** 计算2013年的某月某日是当年的第多少天?* 是星期几?已知2013年元旦是星期二。*/public class Test2 {public static void main(String[] args) {int month, day;in... 阅读全文
posted @ 2014-09-14 13:04 fantasy12436109 阅读(258) 评论(0) 推荐(0) 编辑