|
|
if you put:
char c = 'a';
int d = c++;
System.out.println(d);
I get the same result: it is not happen nothing.
I don't understand why c is not incremented.
The result is 97 who is ascii code of 'a'.
I think that the result would be 97.
modified 17-Feb-17 6:38am.
|
|
|
|
|
Go to the link I give you in my reply above, and spend some useful time learning the Java language first.
|
|
|
|
|
int d = c++;
can be splitted into these two operations
int d = c;
c = c + 1;
You are using the postfix increment which means that the increment operation is performed after the assignment. This is contrary to the prefix increment:
int d = ++c;
c = c + 1;
int d = c;
|
|
|
|
|
yes , I understand.
char c = 'a';
c++;
int d = c;
System.out.println(d);
This si correct.
Yes, I forgot that this is 2 operations when I do = and ++ and the first operation is =.
thank you.
|
|
|
|
|
Because
char c = 'a'
System.out.println(c++);
translate to
char c = 'a'
System.out.println(c);
c++;
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Message Closed
modified 13-Feb-17 9:04am.
|
|
|
|
|
Java is a scary thing - you never know when Oracle will sue you using it...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
modified 13-Feb-17 11:37am.
|
|
|
|
|
I have edited your message to delete the spam address of the subject. I suppose you don't want to help them or to get your messaage reported as spam, do you?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
These forums are not provided for free advertising. If you have some interesting code to share then please see Submission Guidelines[^].
modified 13-Feb-17 11:38am.
|
|
|
|
|
I have edited your message to delete the spam address of the subject. I suppose you don't want to help them or to get your messaage reported as spam, do you?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Didn't realise I had included it; where was it?
|
|
|
|
|
In the subject... which automatically is "Re: original subject" and he had wrote the website in the subject. You can still see them in the search of his messages
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks, I obviously missed that.
|
|
|
|
|
I have been there several times, don't worry
You are welcome
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Why in a Java program that asks for user input the blinking cursor is not positioned where it should be.
Look at this code:
public class GettingInput
{
public static void main(String args[])
{
int x;
int y;
Scanner in = new Scanner(System.in);
System.out.print("Enter a number: ");
x = in.nextInt();
System.out.print("Enter another number: ");
y = in.nextInt();
int sum = x + y;
System.out.println("Sum is " + sum);
}
}
When I run the program the blinking cursor is never where it should be. Seems to me it should be after the word number: cursor should be here.
But I can never get it there.
Is there something I'm doing wrong when I run my program or is this just a Java quirk?
|
|
|
|
|
So where does it happen to be? That works perfectly fine in my case, I ran your code in NetBeans and the following was the output,
run:
Enter a number: 55
Enter another number: 45
Sum is 100
BUILD SUCCESSFUL (total time: 14 seconds)
You can see "55" comes right after "number: " and so on for the next line. The question is which compiler are you using, or what IDE is being used? print must never add "\n" to the output, if that is happening, change the compiler.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I'm using Eclipse Mars. When I run the program it first shows Enter an integer: with no cursor being shown. I then enter a number and then hit Enter and then what happens is it shows Enter an integer: the second time around but the cursor shows up before the Enter an integer:
It's just dumb.
Why doesn't the cursor automatically get placed after the Enter an integer:
Just annoys me. I'm using Eclipse Mars with whatever compiler the JDK ships with.
|
|
|
|
|
That sounds more like an issue with your PC or console settings.
|
|
|
|
|
Not a computer issue. Many people have reported the same thing across the Web.
|
|
|
|
|
I Googled for that and did not find any references that match your problem.
|
|
|
|
|
Might be a problem with the IDE ?
|
|
|
|
|
My slides contains pictures ,editable Charts, tables etc.,
|
|
|
|
|
|
How do we work on the analysis of the periods of ECG ,example Qr alone, and so, therefore, to be compared with the original signal using java .
Regards
|
|
|
|