7,116 Posted Topics

Member Avatar for rahaf_1

Variable c is null, so it’s not an array and line 10 will give a null pointer exception. You need to initialise c to an array of the right size before you try to set any of its elements.

Member Avatar for AssertNull
0
415
Member Avatar for Damo_1

Please give more details of what you are trying to do, and exactly is the problem that is preventing you from making progress.

Member Avatar for JamesCherrill
0
238
Member Avatar for OnlyThierry

This is marked ‘solved’, so can you take a moment to share your solution for the benefit of others? Thanks JC

Member Avatar for JamesCherrill
0
586
Member Avatar for John_165

It looks like you have been experimenting with a variety of layout mangers! Firstly - have you seen the Oracle tutorials - they are excellent. They start here: https://docs.oracle.com/javase/tutorial/uiswing/layout/using.html In my experience they are all too simpistic for anything but the simplest of requirements *except* GridBagLayout and SpringLayout. SpringLayout was …

Member Avatar for JamesCherrill
0
537
Member Avatar for Aakanksha_1
Re: dfs

Very interesting. Did you just want to share that, or is there a question?

Member Avatar for JamesCherrill
0
427
Member Avatar for zebnoon1

Hi zebnoon Sorry, but it does look like there's nobody around at the moment who can help you. People do have very full and busy schedules, but with any luck someone with the necessary knowledge will get a free moment t help you. JC

Member Avatar for mastermyne
0
815
Member Avatar for saurabh.mehta.33234

One thread can both read and write a volatile variable, all the other threads can only read it. You say you are aware of the concept, so what exactly is confusing you, and what exactly do you want an example to show?

Member Avatar for JamesCherrill
0
209
Member Avatar for marshall_1

> EIQ Studio's In English there is no apostophe in the plural "Studios". Not a good start. Is this a) a scam b) wishful thinking by some teenager in his/her parent's bedroom or c) a real thing... ... in which case maybe you should concentrate less on using unskilled labour …

Member Avatar for jwenting
0
238
Member Avatar for Nicole_7
Member Avatar for saurabh.mehta.33234

I know this is marked "solved", bt for the benefit af anyone who has the same problem... To quote from the API doc... > It is imperative that the user manually synchronize on the returned map when iterating over any of its collection views so the loop on lines 70-72 …

Member Avatar for JamesCherrill
0
773
Member Avatar for scheppy

You can check for the two `Shapes` (ellipse and rectangle) intersecting. Which side is then just a tedious testing of the x and y coordinates. Bouncing off a side of a rectangle (assuming it;s horiontal/vertical) is trivial (1), but bouncing off a corner is a different question. If you get …

Member Avatar for scheppy
0
4K
Member Avatar for saurabh.mehta.33234
Member Avatar for saurabh.mehta.33234

> According to the output it seems finally was not executed despite the try block getting completed. ? line 3 of the output appears to be the message from line 23 in the finally block so it looks to me like the finally is being executed. Be careful when reading …

Member Avatar for JamesCherrill
0
427
Member Avatar for scheppy

No time for a proper answer now, but here's some code I use that I modified from something on the web that bounces balls a and b that have position x,y and velocity dx,dy. I gives bounces that look very realistic to me. It's very similar to your code, double …

Member Avatar for scheppy
0
3K
Member Avatar for Luca_1

> If I let the programm run it prints out an infinite number of the maze I choose It looks like the program wil print the entire maze each time it tries each step in finding the solution - so not infinite, but just far too many. Starting to debug …

Member Avatar for rproffitt
0
456
Member Avatar for Saboor880

Can’t you just use the page width that the PrintFormat parameter will give you?

Member Avatar for rproffitt
0
324
Member Avatar for scheppy

Leaking in constructor... The language spec only guarantees that the new object will be in a complete and consistent state *after* the constructor has finished. When you add the key listener you pass a reference to you current object, so it's immediately possible for another class to call methods in …

Member Avatar for scheppy
0
465
Member Avatar for scheppy

Like he said... plus specifically: do you get "in here" printed 30 times per sec?

Member Avatar for scheppy
0
1K
Member Avatar for Saboor880

I think the obfuscation/hacking issue is much over-rated. Although decompiling and modifying a jar is possible, few people have the necessary skills and even fewer can be bothered unless it’s a really desirable program with too high a cost. If you set a sensible price then it will be less …

Member Avatar for Saboor880
0
436
Member Avatar for Rafin Ishraq

There's no need to be rude. A polite request will get a better response.

Member Avatar for scheppy
-4
156
Member Avatar for scheppy

> public Renderer Renderer; You have a variable with exactly the same name as a class. Surprisingly this is valid Java, but it's making your code imcomprehensible. It would be much easier to read if you follow Java conventions and start class names with a capital, variable and method names …

Member Avatar for scheppy
0
1K
Member Avatar for Addvantum

We are here to help people who are trying to work hard and learn. We are not here to do Google searches for people who may be too lazy or too stupid to do their own searches before asking a question. Correct your attitude and try again.

Member Avatar for rproffitt
-2
281
Member Avatar for Prosatanos

It's called a "bubble sort" - just Google for details. Apart from tjhat it just copies a List of students into an array so the sort will be fast, sorts the array, then copies the sorted reults back into the list. That part of the code should work, but it's …

Member Avatar for JamesCherrill
0
187
Member Avatar for Bensaber

If you want to convert a String (eg from a JTextField) to a BigDecimal you can use one of BigDecimal's constructors... String s = " 1234.56"; BigDecimal bd = new BigDecimal(s);

Member Avatar for Bensaber
0
306
Member Avatar for ibenwa

> It would cause quite some security concerns if it did. Indeed. Do you really think browsers and users will have zero protection against some random web site deleting their files so easily? You need to re-think your application design to avoid the need to do this.

Member Avatar for JamesCherrill
0
197
Member Avatar for laguardian
Member Avatar for John_165

OK folks, getting a bit off-topic here?... it's Java. John: I don't see how you got from the problem definition to that code. It looks like you have tried to adapt a different program, with arrays of numbers and primes somehow. Hacking a different program is almost always a bad …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Gl753

What's a "PPS number"? The java.util.Random class has methods for generating random ints, arrays of random bytes etcetc

Member Avatar for Janko_1
0
3K
Member Avatar for alda_1

> heyy can anyone please help me with this homework yes, there are many people here who will help you. But that means "help you to learn how to d o it yourself". Nobody will do it for you. Show what you have done so far, and explain where and …

Member Avatar for Tarek_2
0
303
Member Avatar for Usama_9

The C++11 Standard says that signed integer overflow/underflow behaviour is "undefined", so any compiler can legally do whatever it wants, including ignore it. Ignoring it (on normal computers) is a lot easier and faster that detecting it and doing something sensible. That's C++ for you. > 8.4: If during the …

Member Avatar for JamesCherrill
0
209
Member Avatar for Sam David

Sam: You have not asked a sensible question. We have no idea of what you already know or what help you need. Please read the link RJ gave you and then try again. We do help people, but only those who show some effort and ask answerable questions.

Member Avatar for Sam David
0
497
Member Avatar for divinity02

Where is your `main` method? The code lines 9 etc should be in `main` if you want them executed!

Member Avatar for divinity02
0
3K
Member Avatar for Cj_5

> Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException A null pointer means an unititialised variable (or a return value from a method that returns null) > at Chapter12.TheaterGUI$buttonListener.actionPerformed(TheaterGUI.java:84) You have the original code, so you know which line that refers to So check that line to see which variable is null (if …

Member Avatar for JamesCherrill
0
549
Member Avatar for coroll

Probably the easiest way is to put all the words in a TreeMap (for fast searching) then check every permutation of every subset of your letters to see if it's in the TreeSet. However that will generate a lot of searches if you have a lot of letters, which may …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Fen_1

Line 49 you fail to initialise `i` (which is also used in many other methods) so your loop may or may not execute any number of times. Insert prints "true" because that’s what the insert method returns

Member Avatar for JamesCherrill
0
405
Member Avatar for skimmpy

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in coding your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting …

Member Avatar for stultuske
0
5K
Member Avatar for Petar_1

> NEED THE CODE FOR THIS: That's not what you need. Try again. I can post you an honors degree certificate if thats what you think the world owes you.

Member Avatar for rubberman
0
326
Member Avatar for Harish_8

Harish 1. Your code is unreadable - a solid mess of undocumented stuff strung end-to-end without any thought towards making it comprehensible. It even has gotos! It's useless. 2. Can someone do the AI part of your school project for you? As in cheat? As in get an unfair advantage …

Member Avatar for JamesCherrill
1
565
Member Avatar for Bob

Ty_1 1. Do not hijack old topics for your new question. Start you own new topic. 2. If you do not post your code then nobody can tell you what you are doing wrong!

Member Avatar for JamesCherrill
3
53K
Member Avatar for _1_6

Well, the people who wrote it know how. They even documented it on the web. You even posted a link to that very page as part of your question! What exactly is it you need to know that’s not covered there?

Member Avatar for pty
0
279
Member Avatar for Dietrich_1

> Between or inclusive? The header docs seem clear on this. Dietrich: You have code there, so what is your question exactly? ps: HINT: You should check the API doc for Random's `nextInt` - specifically what range of values it returns.

Member Avatar for rproffitt
0
553
Member Avatar for COKEDUDE

> What if your compiler thinks you mean ... > Why it matters is that your compiler may do that test first as it is low cost. I hate to be a pedant here, but the C language clearly defines the priority of operators, and if your compiler does something …

Member Avatar for AssertNull
0
420
Member Avatar for aman rathi

Hi balajisathya88 Please be aware that there is a policy on this forum of not just giving people the code they need for their homework. People learn best if you point them in the right direction (eg a tutorial, or the name of the class/method they need), then let them …

Member Avatar for stultuske
1
1K
Member Avatar for Mira Kris

That is a very vague and general question. Please ask something more specific so people can answer

Member Avatar for stultuske
0
380
Member Avatar for Dietrich_1

It looks like the spec is badly written Although the method is called "printAll Nums" the spec does NOT say print the numbers, it says return a string (that could be printed). So, don't be distracted by the misleading method name, just read the spec carefully and return "the string …

Member Avatar for JamesCherrill
0
887
Member Avatar for COKEDUDE

Pietiläinen Just a guess... Is it possible that you are using a one byte character set where the a-umlaut is a 2-byte extended code? (easy to check - just replace it with an ordinary a and see what happens)

Member Avatar for cereal
0
254
Member Avatar for Yousaf_1
Member Avatar for Sana_11

Need code <copy of teacher's spec>? No. You first need to learn to be polite and ask sensible questions. You obviously ignored the "[Read This Before Posting A Question](https://www.daniweb.com/programming/threads/435023/read-this-before-posting-a-question)" topic at the top of the page. Read it now, then start again and someone will help you.

Member Avatar for JamesCherrill
-2
210
Member Avatar for Moksuhd

Yes - as above. In fact all your loops and if/else blocks need brackets. The code inside your loop line 15 will be executed for the "end of input" value (<=0), which will corrupt your results. Also `smallest` is initialised to zero, so `if (mark < smallest)` will never be …

Member Avatar for JamesCherrill
0
446
Member Avatar for Jack_30

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" https://www.daniweb.com/welcome/rules Post what you have done so far and someone will help you from there.

Member Avatar for benanamen
0
565

The End.