answersLogoWhite

0

You can increase a counter variable - or any variable for that matter - with the ++ or += operators.

Examples:

// Increase one at a time
for (int i = 1; i <= 10; i++) System.out.println(i);

// Increase two at a time
for (int i = 2; i <= 10; i+=2) System.out.println(i);

// Decrease one at a time
for (int i = 10; i >= 1; i--) System.out.println(i);

// Decrease two at a time
for (int i = 10; i >= 2; i-=2) System.out.println(i);

You could come along without the "++" and "--" operators, but since incrementing or decrementing one at a time is a fairly common situation, a special operator was introduced, as a shortcut.

You can increase a counter variable - or any variable for that matter - with the ++ or += operators.

Examples:

// Increase one at a time
for (int i = 1; i <= 10; i++) System.out.println(i);

// Increase two at a time
for (int i = 2; i <= 10; i+=2) System.out.println(i);

// Decrease one at a time
for (int i = 10; i >= 1; i--) System.out.println(i);

// Decrease two at a time
for (int i = 10; i >= 2; i-=2) System.out.println(i);

You could come along without the "++" and "--" operators, but since incrementing or decrementing one at a time is a fairly common situation, a special operator was introduced, as a shortcut.

You can increase a counter variable - or any variable for that matter - with the ++ or += operators.

Examples:

// Increase one at a time
for (int i = 1; i <= 10; i++) System.out.println(i);

// Increase two at a time
for (int i = 2; i <= 10; i+=2) System.out.println(i);

// Decrease one at a time
for (int i = 10; i >= 1; i--) System.out.println(i);

// Decrease two at a time
for (int i = 10; i >= 2; i-=2) System.out.println(i);

You could come along without the "++" and "--" operators, but since incrementing or decrementing one at a time is a fairly common situation, a special operator was introduced, as a shortcut.

You can increase a counter variable - or any variable for that matter - with the ++ or += operators.

Examples:

// Increase one at a time
for (int i = 1; i <= 10; i++) System.out.println(i);

// Increase two at a time
for (int i = 2; i <= 10; i+=2) System.out.println(i);

// Decrease one at a time
for (int i = 10; i >= 1; i--) System.out.println(i);

// Decrease two at a time
for (int i = 10; i >= 2; i-=2) System.out.println(i);

You could come along without the "++" and "--" operators, but since incrementing or decrementing one at a time is a fairly common situation, a special operator was introduced, as a shortcut.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What is an up-down counter?

A digital counter than can count both up and down, selected by a control signal.


Is the 555 IC an up down counter?

The 555 is a timer, not a counter.


How do you stop browser from exiting when using runescape?

Make sure your java is fully up to date, and lessen the process usage of the laptop/computer but shutting down other programs that are not necessary.


What is the difference between timer and counter?

A counter counts up, a timer couts down.


Designed a sequential circuit that will function as 2 bit-up down counter?

designed a sequential circuit that will function as 2 bit-up down counter


What is ther role of jre in java?

JRE stands for Java Runtime Environment. JRE is the runtime set up that is required by the JVM to execute java programs. The JRE and JVM (Java Virtual Machine) come packaged along with the Java Development Kit (JDK) that we download and install from the suns website to install Java.


What is difference between jvmjre and jdk?

JVM Stands for Java Virtual Machine. JVM is the virtual machine in which a java program gets executed. JRE stands for Java Runtime Environment. JRE is the runtime set up that is required by the JVM to execute java programs. JDK stands for Java Development Kit. JDK is the basic software that gets downloaded from sun's java website if anyone wants to use java.


What are the cordinates of java?

Java, one of the main islands of Indonesia, is centered near 7&deg;30&prime;10&Prime; S, 111&deg;15&prime;47&Prime; E and stretches from about 106&deg; E to 114&deg; E , along the northeast edge of the Indian Ocean in southeast Asia. The Indonesian capital of Jakarta is on Java.


Design mod 9 down counter using j-k fk?

CT up counter N=9 JK


Once you have downloaded and installed the Java SE JDK Update 26 for Windows how do you open it-It shows up as a folder and it doesn't open java program when clicked on?

The Java Development Kit is not a program designed to be opened up and used, rather it is a folder of command line tools used to compile java programs. If you want to use a program to create/edit java code that automates the compiling process check out NetBeans or Eclipse. Also, if you are trying to open an already compiled java program with it, read the documentation that came with the java application on how to run it.


Does Java speed up your internet connection?

No. Java does not speed up your internet connection.


How can you allocate memory dynamically in Java?

To give java more memory there are a series of steps to follow. To start, go to the computer's control panel, select programs, then go to java settings. This should initiate the Java control panel to pop up. Click on the Java tab followed by the view button. Click on the "runtime parameters" and input the specifics desired. Once finished hit okay then apply and it should increase the memory on your Java.