473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

learning loop

I want to write a short program using loop. I wrote one but it doesn’t working. I’m learning loops so it’s hard to find my mistakes. Here’s my code. Please define and correct where I made a mistake.

Expand|Select|Wrap|Line Numbers
  1. class Ce {
  2.     public static void main(String[] args) {
  3.     String tence = "I can use loops.";
  4.     int count = 0;
  5.     while (count++ <= 25000) {
  6.         System.out.println(tence);
  7.         break;
  8.     }
  9.         System.out.println("\nI wrote sentence " + count + " times.");
  10.         System.out.println("I'm learning my lesson.");
  11.     }
  12. }
Apr 24 '07 #1
1 1101
JosAH
11,448 Expert 8TB
Remove that 'break' statement and see what happens then. A break statement
stops your loop immediately and the flow of exectution continues at the first
statement after the loop.

kind regards,

Jos

ps. if you don't have the patience, reduce the number 25000 to, say 25 or so.
Apr 24 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Nick Calladine | last post by:
Learning : Loop to list all dropdown box values on a form Can some one point me in the right direction : I have a form which I want to loop through I basically want to get all the selected...
10
by: MathStudent | last post by:
Can someone take a look at my code and let me know if you see any mistakes? ======================== #include <stdio.h> #include <ctype.h> #include <conio.h> // Used to make the getch() work...
90
by: Jhon smith | last post by:
Hi all,Just wondering are there any problems with learning c from older books,as I have picked up some from 1988,1994,1997,1998. By using books of this age(Im on a tight budget)am I going to...
14
by: Rich | last post by:
Hi, (this is a probably a bit OT here, but comp.lang seems rather desolated, so I'm not sure I would get an answer there. And right now I'm in the middle of learning Python anyway so...) ...
5
by: AlbaClause | last post by:
I'm just learning Python, and I have a question about os.path.join(dirpath, name) and its use. Simply put, I haven't figured out how to use it. I was looking through the Python reference...
26
by: tesh.uk | last post by:
Hi Gurus, I have written the following code with the help of Ivor Horton's Beginning C : // Structures, Arrays of Structures. #include "stdafx.h" #include "stdio.h" #define MY_ARRAY 15
3
by: Trev | last post by:
Hi, I'm learning C# and trying to write the program below, everything works fine until the last section: Console.Write("Would you like to play again y/n: "); again = Console.ReadLine(); if...
2
by: Brad | last post by:
So I've been studying python for a few months (it is my first foray into computer programming) and decided to write my own little simple journaling program. It's all pretty basic stuff but I...
4
by: umpsumps | last post by:
Hello all, I've been trying to teach myself python from "How to Think Like a Python Programmer" and have been trying to write a script that checks 'words.txt' for parameters (letters) given. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.