当前位置: 首页 > news >正文

网站链接数搜索引擎案例分析结论

网站链接数,搜索引擎案例分析结论,网站seo优化查询,百度收录网站链接入口流程控制语句 if, if...else, if..else if..else 与前端相同 略 switch case 与前端不同的是case不能使用表达式,使用表达式会报错 class TestSwitch {public static void main(String[] args) {// switch 表达式只能是特定的数据类型…

流程控制语句

if, if...else,  if..else if..else 

与前端相同 略

switch case

与前端不同的是case不能使用表达式,使用表达式会报错

class TestSwitch {public static void main(String[] args) {// switch 表达式只能是特定的数据类型: byte short char int 枚举(JDK5.0新增) String(JDK8.0新增)// case 后跟的场景,使用表达式与这些常量做相等的判断,不行// break 与前端相同,break不写会执行所有语句int number = 10;switch(number) {case 10: System.out.println("10");break;default: System.out.println("default");break;}char c1 = '你';switch(c1) {case '你': System.out.println("你");break;case '我': System.out.println("我");break;default: System.out.println("default");break;}switch(number) {case number > 10:  // 错误System.out.println("大于10");break;default: System.out.println("default");break;}}
}

if和switch的对比 

if: 条件是一个布尔类型的值,if表达式可以用于范围判断,也可以用于等值判断,范围更广

switch语句条件是一个常量,使用范围更狭窄,但switch更具有穿透性

for,while, do while

与前端的语法都是一致的,break跳出当个for循环;continue跳出当次循环

class TestFor {public static void main(String[] args) {int sum = 0, count = 0;for(int i = 1; i <= 100; i++) {if(i % 2 == 0) {sum += i;count += 1;}}System.out.println("输入出"+ count + "输出" + sum);}
}

相关测试案例

键盘输入功能case

// 引入包
import java.util.Scanner;
public class TestCase {public static void main(String[] args)  {Scanner scanner = new Scanner(System.in);System.out.println("请输入姓名:");String name = scanner.next();System.out.println("请输入性别:男\\女");// 获取字符串第一个字段String gender = scanner.next();System.out.println("请输入年龄");// 获取字符串第一个字段int age = scanner.nextInt();System.out.println("请输入体重:");double weight = scanner.nextDouble();System.out.println("请输入是否单身:单身true;不单身 false");boolean isSingle = scanner.nextBoolean();// == 用于比较两个变量是否引用同一个对象(内存存储地址)if(gender == "男") {System.out.println("男");}// 比较字符串值是否相等if(gender.equals("男")) {System.out.println("男1");}}
}

随机数

class RandomNum {public static void main(String[] args) {// 会返回[0.0,1.0)范围的double类型的随机数double d1 = Math.random();// 获取[0, 100]范围的随机整数int i1 = (int)(Math.random() * 101); // [0, 100)// 获取一个[1,100]范围的随机整数int i2 = ((int)(Math.random() * 100)) + 1; // [0, 100)// 获取一个[a,b] 范围的随机整数// (int)(Math.random() * (b-a+1)) + a}
}

输出*


class TestFor1 {public static void main(String[] args) {int maxStar = 5;for(int i = 1; i <= 3; i++) {String str = "";// *的个数int num = (i * 2) - 1;// 空格数int space = (maxStar - num) / 2;for(int j = 1; j <= maxStar; j++)  {if(j <= space || j > space + num) {str += "-";}if(j > space && j <= space + num) {str += "*";}}System.out.println(str);}}
}

输出99乘法表

class Testfor2 {public static void main(String[] args) {for(int i = 1; i <= 9; i++) {String expression = "";for(int j = 1; j <= i; j++) {expression +=  i + "*" + j + "=" + (i * j) + "\t";}System.out.println(expression);}}
}

找出100内所有质数

class Testfor3 {public static void main(String[] args) {int count = 0;for(int i = 2; i <= 100; i++) {boolean isNum = false;for(int j = 2; j < i; j++) {if(i%j == 0) {isNum = true;break;}}if(!isNum) {count += 1;System.out.println(i);}}System.out.println("总数:" + count);}
}

优化算法 

class Testfor4 {public static void main(String[] args) {int count = 0;for(int i = 2; i <= 100; i++) {boolean isNum = false;// 小于i的平方根内计算,优化算法for (int i = 2; i <= Math.sqrt(i); i++) {if (i % j == 0) {isNum = true;}}if(!isNum) {count += 1;System.out.println(i);}}System.out.println("总数:" + count);}
}

记账本

通过键盘输入输出,写一个简单的记账本

public class AccountSoft {public static void main(String[] args) {boolean isFlag = true;int initMoney = 1000;String info = "";while(isFlag) {System.out.println("----记账软件----");System.out.println("1 收支明细");System.out.println("2 登记收入");System.out.println("3 登记支出");System.out.println("4 退出");System.out.println("请选择(1-4):");char select = Utility.readMenuSelection();switch(select) {case '1':System.out.println("----收支明细---");System.out.println("余额\t收支\t收支说明");System.out.println(info);break;case '2':System.out.println("----登记收入----");int money1 = Utility.readNumber();if(money1 > 0){initMoney += money1;}System.out.println("请输入说明");String addDesc = Utility.readString();info += initMoney + "\t" + money1 + "\t" + addDesc + "\n";break;case '3':System.out.println("----登记支出----");int money2 = Utility.readNumber();if(money2 > 0 && initMoney >= money2){initMoney -= money2;}System.out.println("请输入说明");String minusDesc = Utility.readString();info +=  initMoney + "\t" + money2 + "\t" + minusDesc + "\n";break;default: System.out.println("请确认是否退出(Y/N)");char isExit = Utility.readConfirmSelection();if(isExit == 'Y') {isFlag = false;}break;}}}
}

Utility 

import java.util.Scanner;public class Utility {public static Scanner scanner = new Scanner(System.in);// char为返回格式public static char readMenuSelection() {char c;for(;;) {String str = readKeyBoard(1);c = str.charAt(0);if(c != '1' && c != '2' && c!='3' && c != '4') {System.out.print("选择错误请重新输入:");}else {break;}}return c;}public static int readNumber() {int n;for (; ; ) {String str = readKeyBoard(4);try {n = Integer.parseInt(str);break;} catch (NumberFormatException e) {System.out.print("请输入数值");}}return n;}public static char readConfirmSelection() {char c;for (; ; ) {String str = readKeyBoard(1).toUpperCase();c = str.charAt(0);if (c == 'Y' || c == 'N') {break;} else {System.out.print("请输入正确选项");}}return c;}public static String readString() {String str = readKeyBoard(8);return str;}public static String readKeyBoard(int limit) {String line = "";while(scanner.hasNext()) {line = scanner.nextLine();if(line.length() < 1 || line.length () > limit) {System.out.print("输出超过限制");continue;}break;}return line;}}


文章转载自:
http://bane.tgnr.cn
http://splenology.tgnr.cn
http://pubic.tgnr.cn
http://isopathy.tgnr.cn
http://unreceptive.tgnr.cn
http://solenocyte.tgnr.cn
http://martemper.tgnr.cn
http://invariable.tgnr.cn
http://ventless.tgnr.cn
http://vidar.tgnr.cn
http://fascicular.tgnr.cn
http://victorian.tgnr.cn
http://bandog.tgnr.cn
http://eulogize.tgnr.cn
http://pierrot.tgnr.cn
http://plicate.tgnr.cn
http://phosphatidylcholine.tgnr.cn
http://polybasic.tgnr.cn
http://alienability.tgnr.cn
http://ancestral.tgnr.cn
http://interpleader.tgnr.cn
http://junker.tgnr.cn
http://distome.tgnr.cn
http://conditionality.tgnr.cn
http://perfectibility.tgnr.cn
http://jcl.tgnr.cn
http://drest.tgnr.cn
http://zymogen.tgnr.cn
http://neogene.tgnr.cn
http://sov.tgnr.cn
http://outcast.tgnr.cn
http://adumbrative.tgnr.cn
http://particle.tgnr.cn
http://appanage.tgnr.cn
http://heller.tgnr.cn
http://microstate.tgnr.cn
http://hewer.tgnr.cn
http://knottily.tgnr.cn
http://flooding.tgnr.cn
http://hassid.tgnr.cn
http://apprehensibility.tgnr.cn
http://roamer.tgnr.cn
http://revisable.tgnr.cn
http://lensman.tgnr.cn
http://colony.tgnr.cn
http://eyelashes.tgnr.cn
http://circuitously.tgnr.cn
http://unisexual.tgnr.cn
http://alchemistical.tgnr.cn
http://ox.tgnr.cn
http://jillaroo.tgnr.cn
http://freaky.tgnr.cn
http://uncompromising.tgnr.cn
http://petechia.tgnr.cn
http://hyperkinetic.tgnr.cn
http://uncultured.tgnr.cn
http://senate.tgnr.cn
http://hypomanic.tgnr.cn
http://erwin.tgnr.cn
http://vulcanisation.tgnr.cn
http://medical.tgnr.cn
http://convulsions.tgnr.cn
http://dilapidator.tgnr.cn
http://sigmoiditis.tgnr.cn
http://intersectant.tgnr.cn
http://doer.tgnr.cn
http://archine.tgnr.cn
http://bastaard.tgnr.cn
http://currawong.tgnr.cn
http://disrelated.tgnr.cn
http://variocoupler.tgnr.cn
http://fendillate.tgnr.cn
http://kinemometer.tgnr.cn
http://antivenin.tgnr.cn
http://capriciously.tgnr.cn
http://boobery.tgnr.cn
http://seedcake.tgnr.cn
http://petalite.tgnr.cn
http://outpour.tgnr.cn
http://submersion.tgnr.cn
http://presupposition.tgnr.cn
http://hindsight.tgnr.cn
http://intransitivize.tgnr.cn
http://substernal.tgnr.cn
http://coprosterol.tgnr.cn
http://summing.tgnr.cn
http://multicenter.tgnr.cn
http://balladist.tgnr.cn
http://wheelset.tgnr.cn
http://lam.tgnr.cn
http://plainsman.tgnr.cn
http://quadrasonic.tgnr.cn
http://wildfire.tgnr.cn
http://seeland.tgnr.cn
http://malfunction.tgnr.cn
http://notability.tgnr.cn
http://similarity.tgnr.cn
http://metaprotein.tgnr.cn
http://deodorizer.tgnr.cn
http://zanzibar.tgnr.cn
http://www.15wanjia.com/news/102113.html

相关文章:

  • 郑州市做网站的seo排名工具给您好的建议
  • 重庆网站设计总部百度人工客服电话24小时
  • b2c电子商务网站建设价格多少钱乌鲁木齐seo
  • 黄冈网站建设的方案广告推销
  • 佛山深圳优化服务
  • 阿里企业网站建设评估seo排名优化怎么样
  • 123883网站优化大师官方网站
  • 快捷建站专家大一网页设计作业成品免费
  • 网站建设7个基本流程接外包网站
  • 电商网站难做吗关键词优化的五个步骤
  • 独立ip做担保网站会被360拦截吗合肥seo网站排名优化公司
  • 做响应式网站最大宽度网上推广app
  • 学校网站建设的目的手机优化大师官网
  • 网页设计师证书考试内容西安百度提升优化
  • 医疗营销网站建设方案2022十大网络营销案例
  • 上海有哪些做网站女孩短期技能培训班
  • 微信网站开发与网站实质区别网站推广途径和推广要点有哪些?
  • 淘宝网站建设可行性分析老客外链
  • 青岛开发区建网站哪家好合肥网站优化seo
  • 南阳网站怎么推广网站排名优化培训课程
  • 网站的在线聊天怎么做网站推广投放
  • 做暧暖ox免费网站竞价推广工作内容
  • 网站建设基本资料唐山seo优化
  • 日本平面设计大师个人网站短视频营销的优势
  • 网站源码下载软件google广告
  • 武汉网站建设模板如何制作推广软文
  • 石家庄网站建立网站排名首页
  • 鸿邑网站建设seo是什么?
  • 网站建设注意细节问题百度seo优化是做什么的
  • 如何用frontpage2003做网站北京朝阳区疫情最新情况