在网上发现的那一刻使用此代码
String welcome = "Would you like to play a game?";
for (int i = 0; i < welcome.length(); i++) {
System.out.println(welcome.charAt(i));
}
Run Code Online (Sandbox Code Playgroud)
很基本的东西,但是它真的可以很快地逐行打印出来,我该如何添加一个小暂停,并在上一个字符之后立即打印?最后,它只是说您想玩游戏吗?
我正在使用CMD和Sublime文本。
谢谢!
你可以在下面看到我有一个名为costperkm的变量,通常为0.08,然后我有一个基于数字的数组,然后围绕这些数字构建的第二个数组乘以costperkm,但是我得到错误; http://puu.sh/2sxi7
Scanner costscan=new Scanner(System.in);
double costperkm = costscan.nextDouble();
double distarray[] = new double[5];
distarray[0] = 850;
distarray[1] = 1000;
distarray[2] = 1250;
distarray[3] = 1275;
distarray[4] = 1350;
distarray[5] = 2690;
double costarray[] = new double[5];
costarray[0] = (distarray[0]*costperkm);
costarray[1] = (distarray[1]*costperkm);
costarray[2] = (distarray[2]*costperkm);
costarray[3] = (distarray[3]*costperkm);
costarray[4] = (distarray[4]*costperkm);
costarray[5] = (distarray[5]*costperkm);
System.out.print(costarray[0]);
Run Code Online (Sandbox Code Playgroud) <section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Contact Me</h2>
<hr class="star-primary">
</div>
</div>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- To configure the contact form email address, go to mail/contact_me.php and update the email address in the PHP file on line 19. -->
<!-- The form should work on most web servers, but if the form is not working you may need to configure your web server differently. -->
<form name="sentMessage" id="contactForm" onsubmit="return validate()" action="contactme.php">
<div class="row control-group">
<div …Run Code Online (Sandbox Code Playgroud)