public class a99
{
public static void main (String args[] ){
for (int i = 2 ; i <10 ; i++ ){
for(int j= 2 ; j<10 ; i ++){
System.ot.print( i + " * " + j " = " + i*j );
}
}
System.out.print("111");
}
}
java
2014年2月12日 星期三
2013年12月4日 星期三
java && and閘 判斷大小寫
package cc.home;
public class LetterCheck2 {
public static void main(String[] args) {
char symbol = 'A' ; //設定為字元
symbol = (char)(128.0*Math.random()); //隨機產生0-127隨機字元
if(symbol >= 'A' && symbol <= 'Z' ){
System.out.println("大寫 " + symbol);
}
else {
if(symbol >= 'a' && symbol<= 'z') {
System.out.println("小寫 " +symbol);
}
else {
System.out.println("The code is not a letter");
}
}
}
}
public class LetterCheck2 {
public static void main(String[] args) {
char symbol = 'A' ; //設定為字元
symbol = (char)(128.0*Math.random()); //隨機產生0-127隨機字元
if(symbol >= 'A' && symbol <= 'Z' ){
System.out.println("大寫 " + symbol);
}
else {
if(symbol >= 'a' && symbol<= 'z') {
System.out.println("小寫 " +symbol);
}
else {
System.out.println("The code is not a letter");
}
}
}
}
2013年12月3日 星期二
java 判別字母大小寫 隨機產生一字母
public class LetterCheck {
public static void main(String[] args) {
char symbol = 'A' ; //設定為字元
symbol = (char)(128.0*Math.random()); //隨機產生0-127隨機字元
if (symbol >= 'A'){ //如果大於A 字元
if(symbol <= 'Z'){ // 如果小於 Z字元
System.out.println("you have the capital letter "+symbol); //印出結果 大寫英文A-Z
}
else {
if (symbol >= 'a') { // 如果大於 小寫a 字元
if (symbol <= 'z'){ //如果小於 小寫z 字元
System.out.println("you have the small letter "+symbol ); //印出結果 小寫a-z
}else {
System.out.println("篩選1"); // 全部不符合
}
}else {
System.out.println("篩選2"); //不是大寫A-Z
}
}
} else {
System.out.println("篩選3");//不是小寫a-z
}
}
}
java if-else 判斷單數偶數
public class NumberCheck {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int number = 0 ;
number = 1 + (int) (100*Math.random()); //亂數產生0-99 +1 為100
if (number%2 == 0){
System.out.println("You have got an even number"+ number); //整除為0 是偶數
}
else {
System.out.println("You have got an add number"+number);// 除2有餘數為單數
}
}
}
java 鍵盤輸入兩數值相加
package app2_3;
import java.util.Scanner;
public class hw3_21 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num1 ,num2 ;
Scanner scn = new Scanner(System.in);
System.out.println("請輸入數值1 : ");
num1=scn.nextInt();
System.out.println("請輸入數值2 : ");
num2=scn.nextInt();
System.out.println("兩數值相加為"+ (num1+num2));
}
}
import java.util.Scanner;
public class hw3_21 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int num1 ,num2 ;
Scanner scn = new Scanner(System.in);
System.out.println("請輸入數值1 : ");
num1=scn.nextInt();
System.out.println("請輸入數值2 : ");
num2=scn.nextInt();
System.out.println("兩數值相加為"+ (num1+num2));
}
}
2013年11月28日 星期四
Servlet#第一個Servlet程式
訂閱:
文章 (Atom)