最簡單的java代碼肯定就是這個了,如下:

創(chuàng)新互聯(lián)建站長期為上千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為豐城企業(yè)提供專業(yè)的成都做網(wǎng)站、成都網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設(shè),豐城網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。
public class MyFirstApp
{
public static void main(String[] args)
{
System.out.print("Hello world");
}
}
“hello world”就是應(yīng)該是所有學(xué)java的新手看的第一個代碼了。如果是零基礎(chǔ)的新手朋友們可以來我們的java實驗班試聽,有免費(fèi)的試聽課程幫助學(xué)習(xí)java必備基礎(chǔ)知識,有助教老師為零基礎(chǔ)的人提供個人學(xué)習(xí)方案,學(xué)習(xí)完成后有考評團(tuán)進(jìn)行專業(yè)測試,幫助測評學(xué)員是否適合繼續(xù)學(xué)習(xí)java,15天內(nèi)免費(fèi)幫助來報名體驗實驗班的新手快速入門java,更好的學(xué)習(xí)java!
問題的思路大概如此,1:根據(jù)姓名去emp表查詢可以統(tǒng)計一個count。 2:判斷count是否大于0,如果大于0走els,(count的數(shù)字也可能大于1,所以else里面根據(jù)name獲取一個list)。3:for循環(huán)循環(huán)list,new一個tb_teleponebook的實體,將id set進(jìn)userid字段。保存tb_teleponebook實體即可。
import java.util.Scanner;
public class Variate {
/**
* 數(shù)字排序
*/
public static void variate1(){
Scanner in = new Scanner(System.in);
System.out.println("請輸入第一個數(shù)字:");
float first = in.nextFloat();
System.out.println("請輸入第二個數(shù)字:");
float second = in.nextFloat();
System.out.println("請輸入第三個數(shù)字:");
float third = in.nextFloat();
if(first - second = 0){
?if(second - third = 0){
??? ?System.out.println("三個數(shù)字從大到小順序為:" + first + "=" + second + "=" + third);
?}else if(first - third = 0){
??? ?System.out.println("三個數(shù)字從大到小順序為:" + first + "=" + third + "=" + second);
?}else{
??? ?System.out.println("三個數(shù)字從大到小順序為:" + third + "=" + first + "=" + second);
?}
}else if(first - third = 0){
?System.out.println("三個數(shù)字從大到小順序為:" + second + "=" + first + "=" + third);
}else if(second - third = 0){
?System.out.println("三個數(shù)字從大到小順序為:" + second + "=" + third + "=" + first);
}else{
?System.out.println("三個數(shù)字從大到小順序為:" + third + "=" + second + "=" + first);
}
}
/**
* 利率計算
*/
public static double bonus(){
float profit = 0;
double bonus = 0;
Scanner in = new Scanner(System.in);
System.out.println("請輸入利潤(萬元):");
profit = in.nextFloat();
if(profit = 10){
?bonus = profit * 0.1;
}else if(profit 10 profit = 20){
?bonus = (profit - 10) * 0.075 + 10 * 0.1;
}else if(profit 20 profit = 40){
?bonus = (profit - 20) * 0.05 + 20 * 0.1;
}else if(profit 40 profit = 60){
?bonus = (profit - 40) * 0.03 + 40 * 0.1;
}else if(profit 60 profit = 100){
?bonus = (profit - 60) * 0.015 + 60 * 0.1;
}else if(profit 100){
?bonus = (profit - 100) * 0.01 + 100 * 0.1;
}
return bonus;
}
/**
* 判斷元輔音字母
*/
public static void variate2(){
Scanner in = new Scanner(System.in);
System.out.println("請輸入一個字母:");
char liter = in.next().charAt(0);
boolean vowel = false;
boolean capital = false;
switch (liter){
case 'A' : vowel = capital = true; break;
case 'O' : vowel = capital = true; break;
case 'E' : vowel = capital = true; break;
case 'I' : vowel = capital = true; break;
case 'U' : vowel = capital = true; break;
case 'a' : vowel = true; break;
case 'o' : vowel = true; break;
case 'e' : vowel = true; break;
case 'i' : vowel = true; break;
case 'u' : vowel = true; break;
default : vowel = capital = false;
}
if(vowel || capital){
?if(vowel capital){
??? ?System.out.println("輸入的是大寫元音字母:" + liter);
?}else{
??? ?System.out.println("輸入的是小寫元音字母:" + liter);
?}
}else{
?System.out.println("輸入的是輔音字母:" + liter);
}
}
/**
* 簡單計算
*/
public static void calculator(){
Scanner in = new Scanner(System.in);
double first = 0;
double second = 0;
double result = 0;
char operator;
System.out.println("請輸入第一個數(shù)字:");
first = in.nextDouble();
System.out.println("請輸入第二個數(shù)字:");
second = in.nextDouble();
System.out.println("請輸入運(yùn)算符:");
operator = in.next().charAt(0);
switch(operator){
case '+' : result = first + second; break;
case '-' : result = first - second; break;
case '*' : result = first * second; break;
case '/' : result = first / second; break;
default : result = 0;
}
System.out.println("計算結(jié)果為:" + result);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
variate1();
System.out.println("可提成" + bonus() + "萬元");
variate2();
calculator();
}
}
public static boolean isNumeric(String str){
for(int i=str.length();--i=0;){//從字符串的最后開始判斷
int chr=str.charAt(i); //從字符串中取序號為i的字符
if(chr48 || chr57) //判斷其ascii碼是否為數(shù)字的范圍
return false; //有一個不是數(shù)字則直接返回退出函數(shù)
}
return true; //全部為數(shù)字則返回true
}
文章題目:簡單的判斷java代碼,如何看懂java代碼
文章來源:http://chinadenli.net/article25/dsigdci.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、全網(wǎng)營銷推廣、品牌網(wǎng)站制作、搜索引擎優(yōu)化、軟件開發(fā)、
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)