7,116 Posted Topics

Member Avatar for Cort3z

I think that sos's point was that you shouldn't have to perform that kind of cast. It probably results from a bad design decision. The "correct" solution is to declare the List(s) appropriately with a `? extends ... ` In this particular case the Lists on lines 17 and 21 …

Member Avatar for JamesCherrill
1
7K
Member Avatar for Nymphalys08

Yes, one of the easiest ways to detect duplicates is to use a Collection that does not allow duplicates, eg HashSet. Its `add` method returns false if the set already contains that element.

Member Avatar for Naheedmir
0
52
Member Avatar for asutosh_1
Member Avatar for Asjdkwjsnc

> Hint: Count the steps while traversing the list until encountering position p > isnt it put the method Iterable positions();? Yes. Simply use positions() to loop through the elements incrementing an index and and test each until you find the one you want. Then return its index.

Member Avatar for JamesCherrill
0
181
Member Avatar for happygeek

Seems to me that the essence of "hacking" is to gain access to some resource or capablility that the original software developer did not want you to access. As such it's always going to be crimially illegal and/or a violation of the original software's T.O.S. As such I would leave …

Member Avatar for Naheedmir
1
4K
Member Avatar for Saboor880

JavaDB is just Derby, which moved from Oracle to Apache where it is still very much alive. The most recent release was March 1st 2021 (!) https://db.apache.org/derby/

Member Avatar for Saboor880
0
188
Member Avatar for Craig_11
Member Avatar for Andrew_70

You should explain EXACTLY what "does not work properly" means... eg what error message do you get, or how does the output differ from what you expected. Anyway - for the moment I notice that you have `grades= nextInt();` in 3 places and after two of those you never use …

Member Avatar for Tori_1
0
111
Member Avatar for Tombezlar

Recognise that best AND easy doesn't exist. Oracle's own tutorials are (IMHO) the best - start [here](https://docs.oracle.com/javase/tutorial/getStarted/index.html) As for easy - there are loads of beginner tutorials on the web - mostly out of date and often downright wrong - but OK if you just want a warm fuzzy hand-holding …

Member Avatar for Reverend Jim
0
130
Member Avatar for Andrew_70

Your while test is wrong... while grades<= zero AND >= zero. Grades can't be both those at the same time (unless it is == 0), so the test is false and the loop never gets executed. Because the loop isn't executed you never increment `count`, so that stays at zero. …

Member Avatar for JamesCherrill
0
44
Member Avatar for John_285

Hint: `for (Account acc : gBank) {...` this loops through all the accounts, setting `acc` to refer to each account in turn so in the loop you can use `acc` with all the public methods of the Account class, eg for (Account acc : gBank) { if(acc.getOwner().equals(me)) acc.deposit(lotsOfMoney); }

Member Avatar for JamesCherrill
0
187
Member Avatar for shana_6

All you NEED is the Java Development Kit (JDK) and a text editor (any text editor). IDEs like Eclipse and NetBeans are used by real programmers because they provide all kinds of integrated productivity tools BUT they come at the cost of a huge learning curve. You will find it …

Member Avatar for JamesCherrill
0
88
Member Avatar for VileMuse

You need something like (pseudo code) while there is more input available read coordinates i and j M[i][j] = 1

Member Avatar for JamesCherrill
0
186
Member Avatar for sonalid1701

First, those are two completely different concepts. Overloading is a convenience thing. Use it when you have a method that could be used with different paameters, eg an internet thing that could use an IPV4 or IPV6 address. You could have two methods with slightly differenet names, but the code …

Member Avatar for JamesCherrill
0
71
Member Avatar for Pocokos

You use the new shuffled array to provide N index values in random order. You use those index values to index into all the other arrays. In other words - on line 7 above you set `x` to be the next value in the shuffled array of indexes.

Member Avatar for Biiim
0
165
Member Avatar for Aarav_5

That's a reasonable start. Some errors to fix, and some functionality to implement. What's your question?

Member Avatar for JamesCherrill
0
53
Member Avatar for Computer Doctor

That's going to map pretty closely to the Java equivalents, so whats stopping you? ps: That multi-line string delimited by triple quotes had no equivalent in Java until Java 14 or 15, so make sure you are on the latest version.

Member Avatar for JamesCherrill
0
205
Member Avatar for snow_1

? If you just have 1 thread, using an executor or not, then there's no concurrency issue. If you create two thread instances with the same FutureTask instance and start() them simultaneously then you are open to concurrency problems. I can't think of any reason why someone would do that …

Member Avatar for JamesCherrill
0
83
Member Avatar for phphp

> You may have Java 15 installed, but according to your screenshots, you are using Java 8 It's more bizarre than that. The java version is 1.8 but the compiler is 1.15 Possible reason is that a 1.8 JRE (runtime only) was installed, followed later by a 1.15 JDK (full …

Member Avatar for JamesCherrill
0
125
Member Avatar for TwinPlayz

OK, I looked. It's a standard "complete the code" learning exercise. How far have you got? What have you tried? Exactly what help do you need?

Member Avatar for JamesCherrill
1
102
Member Avatar for jeffmylife

All very technical and graphical.but until you give me at least one practical use, I'm not interested

Member Avatar for Smartfitness33
5
24K
Member Avatar for C_Oleyers

If you store it as a 2D array in Java then it's easy. Remember htat a 2D array is really an array of arrays, so all you need is the check that the `length` of each inner array is the same as the `length` of the outer array. No need …

Member Avatar for JamesCherrill
0
35
Member Avatar for sovrby

Hi Please post your code in the thread here so pleaple can see it easily. Depending on what your question is you may not need to post the whole thing. Use the code block button (the one after B and I) to format and line number it properly. Explain exactly …

Member Avatar for JamesCherrill
0
39
Member Avatar for vindyauwu

> tell me how i insert data in to data base, how to select the data in the database There are many many tutorials on the web that cover this very basic information. Nobody here is going to write a new one just for you. Do some research of your …

Member Avatar for VINITHAPRIYA R
0
36K
Member Avatar for macfan

I was running on the last couple of Betas, and switched to the release version with no regrets. The only problem I hit is that NetBeans crashes on startup, but IntelliJ is just fine, so IDC. M1 for Xmas?

Member Avatar for JamesCherrill
0
66
Member Avatar for abdoosh

At line 48 you have `eElement` so you can use that to test for the ID (or whatever) you are interested in and print or not print accordingly.

Member Avatar for JamesCherrill
0
152
Member Avatar for Reverend Jim
Member Avatar for Naheedmir
1
206
Member Avatar for Reverend Jim

The disturbing thing is that Trump, and most Americans, think they are the world's policeman with the right to intervene and kill people they don't approve of in a foreign country even when they do not present a clear and present threat to the USA. (IMHO the USA should support …

Member Avatar for rproffitt
1
22K
Member Avatar for emamothelegend

What is the "much better technology"? MacOS - better, but a LOT more expensive Windows - more popular, but not necessarily better. And again you have to pay for it. And what's wrong with Linux anyway?

Member Avatar for Reverend Jim
0
223
Member Avatar for BuhRock

Hi shamsudeen98, welcome to DaniWeb You have posted some code to a topic that has been dead for 9 years! The code itself is full of errors, so why did you post it? If you posted it as a solution to this topic then you should have tested it first …

Member Avatar for JamesCherrill
0
14K
Member Avatar for mekineer

Re IOS GM/release The reason developers are upset is that every major release breaks something, and until you have the GM you cannot test for regression bugs or other problems. Ie: users are updating to an OS for which you have not been able to perform proper testing of your …

Member Avatar for Web_14
2
323
Member Avatar for BreighA

I'm going with "can be done" - at least in theory 1. Excel supports 1 million rows 2. Even London has (only) 32 thousand streets ( https://www.proviser.com/uk/towns/london/street-map ) 3. Some streets in London have 2 or more names ( https://www.maps.thehunthouse.com/Streets/New_to_Old_London_Street_Name_Changes.htm )

Member Avatar for BreighA
0
128
Member Avatar for Arnold Christian

Interesting I wait months for a Java question, but I'm not a "Suggested Answerer". Guess I must be really out of favour at DaniHQ. Or maybe it's just that I'm too old (2019 years old according to my profile).

Member Avatar for JamesCherrill
0
78
Member Avatar for Excellent_1
Member Avatar for Emmason
1
3K
Member Avatar for Parth_1

If this is you final year project then aren't you supposed to write it youself?

Member Avatar for hussainmujtaba
0
106
Member Avatar for Naveed_786

The `elseif` on line 17 pairs with the `if` on line 6, so where's the `if` that goes with line 13's `elseif`?

Member Avatar for pritaeas
0
76
Member Avatar for Abdul_68
Member Avatar for davy_yg

I'm with rproffitt. Opera Developer version includes a free built-in VPN. Couldn't be easier, couldn't be cheaper. Great for Pirate Bay if you live in a repressive country like the UK.

Member Avatar for scottoconnor956
0
770
Member Avatar for pritaeas

I agree 100% When I look at latest posts, or Java posts or whatever I want to see them all. If I want to filter I can. but the default "recommended" is worse than useless. Please make it remember my choice of "none".

Member Avatar for Dani
0
622
Member Avatar for Satish_14

Hard to read with no indentation, but it looks like the function at line 27 has its return statement inside an if test, so if the if test fails control will evntually drop through to line 35 where the function finishes without having returned an int.

Member Avatar for DGPickett
0
285
Member Avatar for stefh
Member Avatar for Xozz

It's commendable that you took the time to reply. However, the topic title and the origional post clearly asks for a discussion of 2-dimensional array *as argument*, and the content you posted covers declaration, referencing, and initialisation, but does not address that question.

Member Avatar for JamesCherrill
1
363
Member Avatar for Climber Ty

voogos what you are discussing is called cheating. Lie to your teachers, degrade the efforts of your honest colleagues who actually do the work, waste the chance to learn for yourself, deceive uourself and others about your abilities... What do you do in your spare time? Rob grannies?

Member Avatar for JamesCherrill
0
6K
Member Avatar for jordan17

Yes, that's true... but did you have any particular reason for sharing that today?

Member Avatar for JamesCherrill
0
20
Member Avatar for griswolf

Following on from fearless' suggestion... I'm not sure about Python, but this looks like a using a *factory*, Typically that's for a constructor, but there's no reason not to use it for any complex method call. Eg: suppose it's a car search where you can supply manufacturur, engine size, fuel, …

Member Avatar for JamesCherrill
0
311
Member Avatar for Saboor880

I don't know firebase, but as nobobdy else has answered.... MAYBE there's a time attached to that data, eg 30-5-2019 10am 31-5-2019 11am and your query is defaulting to midnight, ie 30-5-2019 00:00 to 31-5-2019 00:00 ??? If so the fix is to end the date range with a date …

Member Avatar for Lye
1
5K
Member Avatar for cambalinho

You cannot add a speed and a vector. They are different measures. It's mathematically impossible, like trying to add a length to an area. You *can* add a vector, as in i have X,Y(10,20) and the change is is (2,3) , the addition will be: X = X + 2 …

Member Avatar for JamesCherrill
0
154
Member Avatar for John_165

> The scope of a local variable declaration in a block (§14.4) is the rest of the block in which the declaration appears (Java Language Spec 6.3) So the exibited behaviour is what the JLS requires, depending on how you see the multiple assignment, but 4.12.3 seems to clarify that …

Member Avatar for John_165
0
1K
Member Avatar for Yusuf_13

Which comment are you referring to and what info do you want to remove? There are situations in which a mod can edit for you, provided it's covered by the DaniWeb rules.

Member Avatar for rproffitt
0
52
Member Avatar for Vegito1991

As a guess: Your run method contains an infinite loop, so if you call it directly it will never return and the calling program will be frozen. So you need to execute it on a different (new) Thread. (That's why it's called "run" - it implements the Runnable interface that …

Member Avatar for Muhamad_5
0
509

The End.