Click here to Skip to main content
15,437,521 members
Home / Discussions / Java
   

Java

 
AnswerRe: Realm EJB in Wildfly Pin
Richard MacCutchan31-Oct-20 1:07
mveRichard MacCutchan31-Oct-20 1:07 
GeneralRe: Realm EJB in Wildfly Pin
Andy_Bell31-Oct-20 9:01
MemberAndy_Bell31-Oct-20 9:01 
GeneralRe: Realm EJB in Wildfly Pin
Andy_Bell11-Nov-20 23:46
MemberAndy_Bell11-Nov-20 23:46 
Questionanyone know how a program would be written out for this Pin
Member 1497788728-Oct-20 9:53
MemberMember 1497788728-Oct-20 9:53 
AnswerRe: anyone know how a program would be written out for this Pin
Richard MacCutchan28-Oct-20 9:58
mveRichard MacCutchan28-Oct-20 9:58 
GeneralRe: anyone know how a program would be written out for this Pin
Richard MacCutchan28-Oct-20 10:27
mveRichard MacCutchan28-Oct-20 10:27 
QuestionWrite a program using for loop that computes sinx and cosx by using the following power series- sinx=x-x^3/3!+x^5/5!-x^7/7!+.... cosx=1-x^2/2!+x^4/4!-x^6/6!+..... Note-(Here ! is used for factorial of that number and ^ for "power of" Pin
User 1494142126-Oct-20 20:56
MemberUser 1494142126-Oct-20 20:56 
AnswerRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
OriginalGriff26-Oct-20 21:05
mveOriginalGriff26-Oct-20 21:05 
Compiling does not mean your code is right! Laugh | :laugh:
Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email contained the message you wanted to send.

So now you enter the second stage of development (in reality it's the fourth or fifth, but you'll come to the earlier stages later): Testing and Debugging.

Start by looking at what it does do, and how that differs from what you wanted. This is important, because it give you information as to why it's doing it. For example, if a program is intended to let the user enter a number and it doubles it and prints the answer, then if the input / output was like this:
Input   Expected output    Actual output
  1            2                 1
  2            4                 4
  3            6                 9
  4            8                16
Then it's fairly obvious that the problem is with the bit which doubles it - it's not adding itself to itself, or multiplying it by 2, it's multiplying it by itself and returning the square of the input.
So with that, you can look at the code and it's obvious that it's somewhere here:
C#
int Double(int value)
   {
   return value * value;
   }

Once you have an idea what might be going wrong, start using the debugger to find out why. Put a breakpoint on the first line of the method, and run your app. When it reaches the breakpoint, the debugger will stop, and hand control over to you. You can now run your code line-by-line (called "single stepping") and look at (or even change) variable contents as necessary (heck, you can even change the code and try again if you need to).
Think about what each line in the code should do before you execute it, and compare that to what it actually did when you use the "Step over" button to execute each line in turn. Did it do what you expect? If so, move on to the next line.
If not, why not? How does it differ?
Hopefully, that should help you locate which part of that code has a problem, and what the problem is.
This is a skill, and it's one which is well worth developing as it helps you in the real world as well as in development. And like all skills, it only improves by use!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

QuestionRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
Richard MacCutchan26-Oct-20 22:51
mveRichard MacCutchan26-Oct-20 22:51 
QuestionRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
User 1494142127-Oct-20 5:16
MemberUser 1494142127-Oct-20 5:16 
AnswerRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
Richard MacCutchan27-Oct-20 5:24
mveRichard MacCutchan27-Oct-20 5:24 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
User 1494142127-Oct-20 5:39
MemberUser 1494142127-Oct-20 5:39 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
User 1494142127-Oct-20 5:38
MemberUser 1494142127-Oct-20 5:38 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
Richard MacCutchan27-Oct-20 5:42
mveRichard MacCutchan27-Oct-20 5:42 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
User 1494142127-Oct-20 5:46
MemberUser 1494142127-Oct-20 5:46 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
Richard MacCutchan27-Oct-20 5:56
mveRichard MacCutchan27-Oct-20 5:56 
GeneralRe: Using for loop create a bluej program for the question( https://1drv.ms/u/s! Ajrld_fzlfykhx8hc1sbkiufuc_p ) Pin
Richard MacCutchan27-Oct-20 7:10
mveRichard MacCutchan27-Oct-20 7:10 
AnswerRe: Write a program using for loop that computes sinx and cosx by using the following power series- sinx=x-x^3/3!+x^5/5!-x^7/7!+.... cosx=1-x^2/2!+x^4/4!-x^6/6!+..... Note-(Here ! is used for factorial of that number and ^ for "power of" Pin
Patrice T6-Nov-20 15:59
mvePatrice T6-Nov-20 15:59 
AnswerInterview Question locking for Ans Pin
sureshkct26-Oct-20 4:52
Membersureshkct26-Oct-20 4:52 
QuestionRe: Interview Question locking for Ans Pin
Richard MacCutchan26-Oct-20 5:34
mveRichard MacCutchan26-Oct-20 5:34 
GeneralRe: Interview Question locking for Ans Pin
Dave Kreskowiak27-Oct-20 6:54
mveDave Kreskowiak27-Oct-20 6:54 
QuestionJAVA IF ELSE STATEMENT (HELP ME) Pin
tomatomoa24-Oct-20 7:45
Membertomatomoa24-Oct-20 7:45 
AnswerRe: JAVA IF ELSE STATEMENT (HELP ME) Pin
Sandeep Mewara24-Oct-20 8:17
mveSandeep Mewara24-Oct-20 8:17 
GeneralRe: JAVA IF ELSE STATEMENT (HELP ME) Pin
tomatomoa3-Nov-20 2:18
Membertomatomoa3-Nov-20 2:18 
GeneralRe: JAVA IF ELSE STATEMENT (HELP ME) Pin
Richard MacCutchan3-Nov-20 3:11
mveRichard MacCutchan3-Nov-20 3:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.