473,387 Members | 1,379 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,387 software developers and data experts.

% character in switch statement

I've looked online and in my textbook, but can't find any explanations for what "wildcards" do in controlling expression parentheses. I have the following code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 1     switch ( value % 2 )
  3. 2     {
  4. 3         case 0:
  5. 4             outputJTextField.setText( "Even Integer" );
  6. 5
  7. 6         case 1:
  8. 7             outputJTextField.setText( "Odd Integer" );
  9. 8             break;
  10. 9
  11. 10     } // end switch
  12.  
  13.  
I can't figure out what the "%" does in my switch controlling expression. Can anyone please provide me with a list of wildcard characters that are recognized in Java switches, and their uses?

Thanks.
Nov 7 '07 #1
2 2313
r035198x
13,262 8TB
I've looked online and in my textbook, but can't find any explanations for what "wildcards" do in controlling expression parentheses. I have the following code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 1     switch ( value % 2 )
  3. 2     {
  4. 3         case 0:
  5. 4             outputJTextField.setText( "Even Integer" );
  6. 5
  7. 6         case 1:
  8. 7             outputJTextField.setText( "Odd Integer" );
  9. 8             break;
  10. 9
  11. 10     } // end switch
  12.  
  13.  
I can't figure out what the "%" does in my switch controlling expression. Can anyone please provide me with a list of wildcard characters that are recognized in Java switches, and their uses?

Thanks.
% is not a wild card character. It is an operator. Google "% operator Java" and find out what it does.
Nov 8 '07 #2
heat84
118 100+
Perhaps understanding how the switch statement works can be of help to you.
Nov 14 '07 #3

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

Similar topics

7
by: Mark Hobley | last post by:
I am trying to rewrite a section of code within an existing program. This is a section of code (simplified and non-working) showing the structure that I am trying to achieve: char *ParseString...
12
by: | last post by:
Is it fine to call another method from Switch? Eg. Switch (stringVar) { case ("a"): somVar = "whatever"; Another_Method(); //call another method return;
2
by: Phillip B Oldham | last post by:
What would be the optimal/pythonic way to subject an object to a number of tests (based on the object's attributes) and redirect program flow? Say I had the following: pets = {'name':...
13
by: Satya | last post by:
Hi everyone, This is the first time iam posting excuse me if iam making any mistake. My question is iam using a switch case statement in which i have around 100 case statements to compare. so...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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...

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.