首页 \ 问答 \ 从一个开关里走出来,但没有布尔值,这有可能吗?(Going out from a switch inside a do while, but without a boolean, it's possible? Java)

从一个开关里走出来,但没有布尔值,这有可能吗?(Going out from a switch inside a do while, but without a boolean, it's possible? Java)

所以这个代码是关于在一个do中给出一个输入的限制。 在这种情况下,你有3个机会继续。 在那之后停止,也有o​​portunitie停止只是提示任何键加入,而且当你开始时,你是否有oportunitie(这里进入开关)退出程序。 问题或我卡住的地方在这里。

也许这可能没有布尔值,或者可能改变或添加我还不知道的东西。 对不起,我试图找到一个答案,但我看到它是关于走出一个while循环whith布尔左右。 不是这样的。

    Scanner kb = new Scanner(System.in);
    // c = continue
    char c;
    // attempt to limit the input to 3 times
    int attempt = 3;
    // option = op
    int op = 0;

    do {
        do{
            System.out.println("Choose continue[0] or go out[1].");
            while  (!kb.hasNextInt()) {
                kb.nextLine();
                System.out.println("It's not a number.");                   
            }
            op = kb.nextInt();
        } while ( op <= -1 || op >= 2 );

        switch (op) {
        case 0:
            System.out.println("Continue!");
            break;
        case 1:     //here I tried; attempt = -1  
            break;  //is where I think it needs to be something
        default:
            break;
        }

        System.out.println("Do you wanna try again,"+attempt+" less?[c]+enter\n"
                + "Any other key + enter to exit.");
        c = kb.next(".").toUpperCase().charAt(0);
        attempt--;
    } while ( attempt > 0 && ( c == 'C' ) );
            //here also to put !( op == 0 )
    kb.close();

So the code is about giving a limit of inputs in a do while. In this case you have 3 oportunities to continue. After that the do while stops, also you have the oportunitie to stop just presing any key plus enter, but also when you start, do you have the oportunitie (here enters the switch) to exit the program. The problem or where I get stuck is here.

That maybe it's possible without a boolean, or maybe changing or adding something that I don't yet know. Sorry I try to find an answer but all I saw it's about going out a while loop whith boolean or so. Not like this.

    Scanner kb = new Scanner(System.in);
    // c = continue
    char c;
    // attempt to limit the input to 3 times
    int attempt = 3;
    // option = op
    int op = 0;

    do {
        do{
            System.out.println("Choose continue[0] or go out[1].");
            while  (!kb.hasNextInt()) {
                kb.nextLine();
                System.out.println("It's not a number.");                   
            }
            op = kb.nextInt();
        } while ( op <= -1 || op >= 2 );

        switch (op) {
        case 0:
            System.out.println("Continue!");
            break;
        case 1:     //here I tried; attempt = -1  
            break;  //is where I think it needs to be something
        default:
            break;
        }

        System.out.println("Do you wanna try again,"+attempt+" less?[c]+enter\n"
                + "Any other key + enter to exit.");
        c = kb.next(".").toUpperCase().charAt(0);
        attempt--;
    } while ( attempt > 0 && ( c == 'C' ) );
            //here also to put !( op == 0 )
    kb.close();

原文:https://stackoverflow.com/questions/47147451
更新时间:2021-11-13 18:11

最满意答案

搜索 3gipv6 vpn
手机电脑都可以用
官网有手机的设置教程
电脑直接下载个客户端登录
连接成功后就可以注册和访问 Google facebook 推特 YTB等网站

其他回答

需要连接国外的服务器
我用的网一vpn注册和登录facebook的,你可以去试试。

相关问答

更多
  • 不要共享或者代创建账户,非常不安全。在国内需要连接到国际网络,才能连接到Facebook、谷歌等海外公司的服务器。但以前的V*N通信技术因为现在的新规定,服务器都已经关闭或者IP被屏蔽,并且运营商大批量检测都已经切断了连接,不能再使用,HOSTS更是早就不能再使用了。 而且即使可以连接到谷歌应用商店等模块,谷歌学术和Facebook为了防止机器人采集滥用,很多多人登录滥用过的IP地址都会屏蔽,显示拒绝访问,关闭风险账户等。目前可以连接到国际网络并可以使用的有2BSS等这些。 因为创建账户后的日常使用也是需要 ...
  • FaceBook因为其服务商不愿意遵守中国的法律,所以不获准许在中国范围内开展业务。需要把本地IP改成外地的IP地址以后。这样就需要一个代理软件了。免费的代理都不稳定的。推荐你使用远足加速器。代理IP之后,详细注册步骤如下: 手机步骤: 第一步:搜悦游下载加速器 第二步:免费注册账号 第三步:连接大陆以外的节点 第四步:打开浏览器输入你要浏览的网址 手机设置vpn的方法 设置-网络或者通用-虚拟网络(vpn) 类型:pptp 描述:vpn 填上账号密码和IP连接 电脑的步骤: 1.搜索facebook,进入 ...
  • gitlab.com注册时需要输入验证码,就是reCAPTCHA,类似于12306的验证码。但是这个验证码是Google提供的,所以你懂的,需要翻*Q才能看得到验证码!!
  • 好像是不是需要,翻&* 墙,,软件
  • 关于苹果手机注册方法要先打开手机设置,在点开通用、点开之后连接巧玲vpn,连接vpn之后就可以注册fk了 连接成功后就可以注册了 参考巧玲vpn
  • facebook是全球最大的社交网站,由于一些其他原因,在中国大陆无法正常使用,在大陆以外的地区可正常注册使用。为遵守国家相关法令规定,本文只介绍facebook如何进行注册,对如何在中国大陆使用不作介绍 打开浏览器,在地址栏输入“www.facebook.com”,进入facebook的主页,在登录框下面点击“注册facebook”按钮 在弹出的页面中填写一些必要的注册信息,如姓名、邮箱、生日、密码等信息。这里一定要填写正确的邮箱地址,要接收验证邮件,全部填写完成后再点击下面的“注册”按钮 登录注册时填写 ...
  • 搜索 3gipv6 vpn 手机电脑都可以用 官网有手机的设置教程 电脑直接下载个客户端登录 连接成功后就可以注册和访问 Google facebook 推特 YTB等网站
  • 安卓手机设置VPN方法 一、打开“设置”,找到“更多网络” 二、在更多网络列表中点击 VPN 选项,选择创建一个新的 VPN 连接 三、选择PPTP类型,接着输入 VPN 的名称,优度vpn,和 VPN 的服务器地址,用户名及密码,记得将PPP加密选项关掉 四、保存,接着连接。(连接成功后,可以在百度查询手机IP) 连接之后就可以上Instagram,Facebook,Google等国外网站了
  • 没有公开的方式来获取这些信息。 抱歉。 There's no public way to get this information. Sorry.
  • 使用Facebook FacePilation插件时有很多选择。 使用该插件,我希望能满足您的所有需求。 http://developers.facebook.com/docs/reference/plugins/facepile/ There are so many options when you go with Facebook FacePilation plugin. Use that plugin, we will be getting all of your needs i hope. http ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。