Greater than sign in switch statement
it wont allow me to use the greater than sign in this program how can i fix this?
public class q2b
public static void main (String [] args)
int x = 2;
switch (x)
case 'x < 1'
System.out.println("x is less than 1");
break;
}
what do u mean by posting the print statements,
this is the new code
public class q2b
public static void main (String [] args)
int x = 2;
switch (x)
case '1':
System.out.println("x is 1");
break;
case '2':
System.out.println("x is2");
break;
case '3':
System.out.println("x is 3");
break;
case '4':
System.out.println("x is 4");
break;
default:
System.out.println("x is greater than 4 or x is less than 1");
break;
}i should be seeing "x is2" but instead it is showing up as "x is greater than 4 or x is less than 1"
please help
Similar Messages
-
i have a > (greater than) sign in my wi-fi password and cant enter it on my apple tv, any suggestions?
Uh, change the password on the wifi?
Do I win a prize? -
Showing the amper sign and greater than sign in a report
Hi All,
I am saving html code to the table and it saves exactly as I save it but when I display it I need to replace certain characters with other values so it shows as it was saved.
<code>
select replace(replace(replace(ACTION,'>','>'),'<','<'),chr(10),'<BR>') "Action"
from test_table1
</code>
Example:
the greater than sign I replace with an amper sign, gt;
the less than sign I replace with an amper sign, lt;
the chr(10) I replace with a BR tag.
If I save the "amper sign, gt;" to the database what do I use to have it show an " amper sign, gt;" in my report column?
BillBill,
How about using the package
DBMS_XMLGEN.convert(<<value>>, 0)
when retreiving from the table and
DBMS_XMLGEN.convert(<<value>>, 1)
when saving to the database.
This package will take care of all of your special characters.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Trying to use greater than in a case statement
What is the correct way to write this case statement?
Case
F.NextOrder2
> F.CutOff
Then
Else F.NextOrder2
as NextOrder3You're missing END, e.g.
CASE when F.NextOrder2 > F.CutOff then '' else cast(F.NextOrder2 as varchar(100)) end as NextOrder3
All values in the CASE statement must be of the same data type.
See this blog post why
SQL Server Case/When Data Type problems
Premature optimization is the root of all evil in programming. (c) by Donald Knuth
Naomi Nosonovsky, Sr. Programmer-Analyst
My blog -
Auto insert closing greater than sign
I am trying to transition from cfeclipse. When I type a '<' I want cfbuilder to insert the closing '>' like it did in cfeclipse. If the tag I enter requires a closing tag then I type over the '>' with my own '>' and it closes the tag.
So, typing '<cfdump' gets me <cfdump>
typing '<cfoutput>' gets me '<cfoutput></cfoutput>'
and so on. Is there anyway to customize this behavior?The closest you’ll likely get is under Preferences>ColdFusion>Profiles>Editor>Typing, where there is an option for “auto-close tags”. I don’t know that the choices offered will do exactly what you want, and I’m not aware of any way to customize such things, though it may well be possible.
also, in case you ask any follow-up questions, it could be helpful to indicate if you are talking about CFBuilder 3 or 2.
/charlie -
<blockquote>Locking duplicate thread.<br>
Please continue here: [[/questions/857792]]</blockquote>
> doesn't show up on my screen properly. It does when I type, but it doesn't once it shows up as a tweetSuch an HTML escape conversion to the HTML entity is usually done automatically to avoid problems with browsers interpreting the > as a closing HTML tag.
If you type &gt; then the & might get converted to &amp; and thus show the HTML entity as plain text like it has been entered. -
I am comparing two date fields from two tables. Both are in DATE format. The dates look like this: 22-Apr-2006 07:00:10 AM and 01-Jun-2007 12:00:00 AM. I am adding this statement to a WHERE clause:
and vendors.vend_obsolete_date > document_xref.acceptance_date;
In this particualr case, I should get no result because the 1st date came before the 2nd date. But when I run my program, it seems to be ignoring my > statement. Is using a greater than sign the proper syntax to compare if the 1st date field is bigger (came after) another?
Thanks!Greater than works on DATE columns, no problem. A simple test confirms it.
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 9 17:50:52 2007
select 'oops, something is wrong' as result
from dual
where
to_date( '22-Apr-2006 07:00:10 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
> to_date( '01-Jun-2007 12:00:00 AM', 'dd-Mon-yyyy hh12:mi:ss AM' )
no rows selectedThere must be something else about your query or data that's causing the anomaly.
Joe Fuda
SQL Snippets -
Error Writing Less Than Sign with FileAdapter
Hello.
Looking at the Flow Trace I can that the input variable of the FileAdapter is being populated correctly (XML tags). When looking at the file's contents though, the result of the less than sign is its character entity: '<';.
Is there a way to force it to print the less than sign? Also, why does it write the character entity for the less than sign and not the greater than sign?
Thanks.
Edited by: oracleistheway on May 24, 2013 6:32 AMHi Arik. Thank you for that information but it is not working. I think it is not working because the DOE feature is done during an XSL process.
I was able to get my desired result by creating a native file and Delimited type. I then selected File contains only one record and had it delimited by Single Space and no optional delimiter.
Thank you all for looking at this thread.
Edited by: oracleistheway on May 26, 2013 10:33 AM -
Switch statement with println() for enum
Hi,
I have this exercise maybe you could help with:
I have to create an enum class and then print out a description of each of the values from a switch.
This is what I've done..
enum PaperCurrency {
FIVE, TEN, TWENTY, FIFTY, ONE_HUNDRED, TWO_HUNDRED
public class Ex22 {
PaperCurrency amount;
Ex22(PaperCurrency amount) {
this.amount = amount;
void describe() {
switch(amount) {
case FIVE: System.out.println("five dollar note");
case TEN: System.out.println("ten dollar note");
case TWENTY: System.out.println("twenty dollar note");
case FIFTY: System.out.println("fifty dollar note");
case ONE_HUNDRED: System.out.println("a hundred dollar note");
case TWO_HUNDRED: System.out.println("two hundred dollar note");
static void main(String[] args) {
Ex22
fiveDollars = new Ex22(PaperCurrency.FIVE),
tenDollars = new Ex22(PaperCurrency.TEN),
twentyDollars = new Ex22(PaperCurrency.TWENTY),
fiftyDollars = new Ex22 (PaperCurrency.FIFTY),
aHundredDollars = new Ex22 (PaperCurrency.ONE_HUNDRED),
twoHundredDollars = new Ex22 (PaperCurrency.TWO_HUNDRED);
fiveDollars.describe();
}There are no compilation errors.
The print out on the console is like this for fiveDollars.describe():
five dollar note
ten dollar note
twenty dollar note
fifty dollar note
a hundred dollar note
two hundred dollar note
and it is supposed to be:
five dollar note.
My question is how to only print out the relevant description instead of all of them? Is my switch wrong?
Thanks for any helpIf you can, it makes more sense to add functionality to an enum type than to write switch statements:
public enum PaperCurrency {
FIVE("five dollar note"),
TEN("ten dollar note"),
TWENTY("twenty dollar note"),
FIFTY("fifty dollar note"),
ONE_HUNDRED("one hundred dollar note"),
TWO_HUNDRED("two hundred dollar note");
private String description;
private PaperCurrency(String desc) {
description = desc;
public String getDescription() {
return description;
public static void main(String[] args) {
System.out.println(PaperCurrency.TEN.getDescription());
} -
CcBPM - switch with a condition (greater than) in XI 7.0
Hello.
I have this BPM that must have a switch condition like:
IF <field xpto> of the received message is greater than 0.
branch 1.
ELSE.
branch 2.
ENDIF.
In XI 7.1 is easy, because the condition editor has logical expressions like >, <, etc ...
In XI 7.0 we don't have that, but in SAP help I read:
You want to formulate the following condition: The booking number (BookingNumber) is greater than 0100.
Since the greater than (>) operator is not available in the condition editor, you can use the following solution: You define the relevant logical expression in the expression editor by means of an XPath predicate, and assign it to a node element. Using the condition editor you then just query the existence of this node element (by using the existence operator (EX)).
This means you first create the following expression in the expression editor:
/FlightBookingOrderConfirmation [BookingID/BookingNumber > 0100]
Using the condition editor, you then formulate the following condition:
(/FlightBookingOrderConfirmation [BookingID/BookingNumber > 0100] EX)
The meaning of this condition is as follows:
A node element FlightBookingOrderConfirmation exists, to which the following applies: The content of the subelement BookingID/BookingNumber is greater than 0100.
In my example, the xpath for the variable is:
/p4:EventMessage/p4:MessageBody/p5:Order/p5:Totals/p5:TotalGrossAmount
But i'm not getting how to use the bracket condition.
Regards,
Valter Oliveira.
Edited by: Valter Oliveira on Mar 10, 2009 6:04 PMHi, valter:
Existence operator (EX) is to check if the node exist in your source message or not.
It is used in Conditional Editor, mostly in the conditional routing in ID.
IF <field xpto> of the received message is greater than 0.
branch 1.
ELSE.
branch 2.
ENDIF.
If your branch 1 or 2 is a send step, then you can use the conditional routing to substitute BPM logic.
otherwise, you can not use conditon editor to replace your BPM logics.
Regards.
Liang -
T400 switches sleeping mode when opening angle greater than 40 degrees
When you open the machine to boot, I must open in the corner from 0-40 degrees. I have to slid hand to press the Power button, the computer boots normally into Windows 7. Then:
- When I open angle greater than 40 degrees (40-180 degrees), the machine switches to sleeping.
- When closed off the screen in less than 40 degree angle, the machine is turned on (switch to normal working mode)
Error picture
Please tell me the cause and solution.
Thanks for any suggestion
Cuong Le
Spoiler (Highlight to read)
Solved!
Go to Solution.Hi Cuonglp,
Welcome to Lenovo Community!
As per the query we understood that you are facing an issue with Display on your ThinkPad T400.
In this case the issue might be with LCD cable, I suggest you to check with reseating LCD cable once.
Please click here to visit the link on how to go with reseating the cable, go to page 143.
Hope this helps.
Best regards,
Hemanth Kumar
Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
Follow @LenovoForums on Twitter! -
How to convert switch statement into iif than else statement in SSRS
Hi All;
How do i convert switch statement into iif statement in ssrs
=
Switch(
Fields!createdonValue.Value = Now(), "Today",
Fields!createdonValue.Value = DateAdd("d",-1,Today()),"Yesterday",
Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -6,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Week",
Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -13,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Fortnight",
Fields!createdonValue.Value >= DateValue(DateAdd("M",-1,DateAdd("D",-(Day(Now)-1),Now))) and
Fields!createdonValue.Value <= DateValue(DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now))),"Last Month",
Fields!createdonValue.Value >= DateSerial(Year(Now()), 1, 1) and
Fields!createdonValue.Value <= DateSerial(Year(Now()), 12, 31),"Year to Date"
Any help much appreciated
Thanks
Pradnya07Not sure why you want to se IIF as Switch is more compact
Anyways it will look like this
=IIf(
Fields!createdonValue.Value = Now(), "Today",IIf(
Fields!createdonValue.Value = DateAdd("d",-1,Today()),"Yesterday",Iif(
Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -6,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Week",IIf(
Fields!createdonValue.Value >= FORMATDATETIME(DateAdd(DateInterval.Day, -13,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate) and
Fields!createdonValue.Value <= FORMATDATETIME(DateAdd(DateInterval.Day, -0,DateAdd(DateInterval.Day, 1-Weekday(today),Today)),DATEFORMAT.ShortDate),"Last Fortnight",IIf(
Fields!createdonValue.Value >= DateValue(DateAdd("M",-1,DateAdd("D",-(Day(Now)-1),Now))) and
Fields!createdonValue.Value <= DateValue(DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now))),"Last Month",IIf(
Fields!createdonValue.Value >= DateSerial(Year(Now()), 1, 1) and
Fields!createdonValue.Value <= DateSerial(Year(Now()), 12, 31),"Year to Date")))))
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Count statement for fields greater than 10 characters
Hi,
I am trying to write a query to select results from a database table where the results are only fields greater than 10 characters in length.
e.g.
Table
Employee----
Andrew
Jennifer Smith
Jamal
the query would only show the result Jennifer Smith because this field exceeds 10 characters in length.
Any help is appreciated....Have you tried coding anything yet for this homework assignment?
HINT: Use the LENGTH() function. -
Update statement with a greater than Value
I created this unique codes and
I need all [FRMDAT] field set to ‘12/31/2014’ in the MKLOPT table, where the [JOBCOD] in the VALUE list BELOW have a [FRMDAT] that is currently (greater
than) > ‘12/31/2014’
VALUE LIST
PH00059
PH02775
PH03051
PH03305
PH03336
PH03342
PH03371
PH03992
PH03993
PH03994UPDATE [MKLOPT]
SET [FRMDAT] = '12/31/2014'
WHERE [JOBCOD] IN ( 'PH00059', 'PH02775', 'PH03051', 'PH03305',
'PH03336', 'PH03342', 'PH03371', 'PH03992',
'PH03993', 'PH03994' )
AND [FRMDAT] > '12/31/2014' -
Switch statement for AS3 - Flash CS3
Hey guys, I currently have a code of a switch statement for as1- as2.
This is it:
switch (int(Math.random() * 20))
case 0:
hint = "The total amount of confusion in this world remains constant. It just gets shifted around.";
break;
case 1:
hint = "If you experience poor performance, adjust the quality settings in your preference menu option.";
break;
case 2:
hint = "Anticipation of death is better than death itself.";
break;
case 3:
hint = "At the core of all well-founded belief lies belief that is unfounded.";
break;
case 4:
hint = "The problem with instant gratification is that it takes too long.";
break;
case 5:
hint = "Never let your schooling interfere with your education.";
break;
case 6:
hint = "Beware of geeks bearing gifs.";
break;
case 7:
hint = "Collaboration is essential: It allows you to blame someone else.";
break;
case 8:
hint = "Read my MIPs - no new VAXes.";
break;
case 9:
hint = "Where is the sea, said the fish, as they swam through it.";
break;
case 10:
hint = "You can safely blame any bugs on Aoedipus, who is too busy grinding battlegrounds to do QA on her own work.";
break;
case 11:
hint = "Anything worth doing is worth overdoing.";
break;
case 12:
hint = "There is more to life than increasing its speed.";
break;
case 13:
hint = "Don\'t worry, this will take about as long as the time it takes to play a 2v2 match with 4 ret pallies.";
break;
case 14:
hint = "There is nothing worse than the brilliant image of a fuzzy concept.";
break;
case 15:
hint = "If you are not part of the solution, you are part of the precipitate.";
break;
case 16:
hint = "Two wrongs don\'t make a right, but three lefts do.";
break;
case 17:
hint = "The heresy of today is the logic of tomorrow.";
break;
case 18:
hint = "It\'s not that life is so short, it\'s just that you\'re dead a really long time.";
break;
case 19:
hint = "Those who love sausage, the law, and holy canon should never watch any of them being made.";
break;
case 20:
hint = "What if there were no hypothetical questions?";
break;
} // End of switch
hint = "HINT: " + hint;
This code is for a dynamic tet with the var 'hint' (No ' ' )
But in as3 there is no var and I am having trouble converting it to AS3 coding, can someone show me the correct conversion of the code to make it work with AS3. I will make the instance name 'hint'.
Thank you ahead of time.In addition to what other guys said, if you still want to use switch it should be:
switch (Math.round(Math.random() * 20)) - this will cover all the possible integers.
Nevertheless, I believe using switch in this case is not as efficient and scalable as using, say, array.
1. array index access is faster than switch.
2. if you need to make additions, you will need to make additions in switch while with array you just need to add/subtract member
3. if you will need to switch to a more dynamic model (say, getting hints from xml) - it will not be possible with switch
4. you may need a greater degree of randmization (Math.random is not as random as one may think) in which case resorting/reordering array is much simpler and faster.
So, I suggest you switch to the following code:
var hints:Array = [];
hints[0] = "Anticipation of death is better than death itself.";
hints[1] = "Anything worth doing is worth overdoing.";
hints[2] = "At the core of all well-founded belief lies belief that is unfounded.";
hints[3] = "Beware of geeks bearing gifs.";
hints[4] = "Collaboration is essential: It allows you to blame someone else.";
hints[5] = "Don\'t worry, this will take about as long as the time it takes to play a 2v2 match with 4 ret pallies.";
hints[6] = "If you are not part of the solution, you are part of the precipitate.";
hints[7] = "If you experience poor performance, adjust the quality settings in your preference menu option.";
hints[8] = "It\'s not that life is so short, it\'s just that you\'re dead a really long time.";
hints[9] = "Never let your schooling interfere with your education.";
hints[10] = "Read my MIPs - no new VAXes.";
hints[11] = "The heresy of today is the logic of tomorrow.";
hints[12] = "The problem with instant gratification is that it takes too long.";
hints[13] = "The total amount of confusion in this world remains constant. It just gets shifted around.";
hints[14] = "There is more to life than increasing its speed.";
hints[15] = "There is nothing worse than the brilliant image of a fuzzy concept.";
hints[16] = "Those who love sausage, the law, and holy canon should never watch any of them being made.";
hints[17] = "Two wrongs don\'t make a right, but three lefts do.";
hints[18] = "What if there were no hypothetical questions?";
hints[19] = "Where is the sea, said the fish, as they swam through it.";
hints[20] = "You can safely blame any bugs on Aoedipus, who is too busy grinding battlegrounds to do QA on her own work.";
hint = hints[int(Math.random() * hints.length)];
// OR
hint = hints[Math.round(Math.random() * (hints.length - 1))];
Maybe you are looking for
-
Tacacs do not function in Nexus 5000
Dear Mister By someone reason, the Tacas is not functioning in my Nexus 5000. I am using the next configuration : tacacs-server key 7 "0310551D121F2D595D" ip tacacs source-interface Vlan5 tacacs-server host 10.20.2.80 tacacs-server host 10.20.16.138
-
Session Pooling for CRMoD - Web services.
Hi, We have a Java application which fetches the Contact Data on the basis of the Phone Number in CRMoD, using web services. (it happens on a hyperlink click). Before fetching the contact data, we establish the session between our app and CRMoD using
-
Multiple Galleries in Slideshow
I would like to have categories of photos in my gallery page a user could click on so as not to have to view 200 photos in one slideshow. Can this be done? This is for a photography website. thanks, chris
-
RAID 1 question for external drives...
Hope this is the right category for this question... I have a 2-dock external hard drive (Icy Dock with eSATA and USB) and just put in two 2TB drives to handle all my video. When I plug it into my MBP (via USB), the LED indicators - from Icy Dock's s
-
if this is on box-office any reason why showing as £0.00 rental