Posts
 
Reputation
Joined
Last Seen
Ranked #633
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
86% Quality Score
Upvotes Received
6
Posts with Upvotes
6
Upvoting Members
6
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
3 Commented Posts
0 Endorsements
Ranked #864
~20.3K People Reached
Favorite Tags

40 Posted Topics

Member Avatar for daudiam
Member Avatar for venkat arun

Arrays/Objects ARE accessed using reference variables. Parameters are passed by value in Java, so if you pass an array to a method it is a copy of the reference to the Object or array that is passed not a whole copy of each element in the array. It goes to …

Member Avatar for sbp94
0
165
Member Avatar for badnack

I assume you are using self signed certificates. Is your friend using a proper signed certificate?

Member Avatar for badnack
0
347
Member Avatar for gourav1
Member Avatar for rutwvu

Looks like you are learning the hard way parallel programming. MPI has all the tools to do this relatively painlessly. Doing it the hard way I guess: create original array containing all the data and two other arrays half the size, create your two sub processes, each subprocess sorts one …

Member Avatar for rutwvu
0
1K
Member Avatar for subone

well known method: (( 1stNumber + 2ndNumber ) * numberOfNumbers) / 2 eg. 1st Number = 4 2nd = number 8 ( ( 4 + 8 ) * ( 8 - 4 + 1 ) ) / 2 ( 12 * 5 ) / 2 = 30

Member Avatar for aspire1
0
305
Member Avatar for Santosh gupta

The default .hashCode() method uses the contents of the string to create the hashcode so unsuprisingly all the values are the same. A better test is: [code] String str1="ABC"; String str2="ABC"; String str3 = new String("ABC"); if( str1 == str2 ) System.out.println( "str1 and str2 reference same object"); else System.out.println( …

Member Avatar for Santosh gupta
0
105
Member Avatar for laguardian

Just out of interest, here is a recursive method ( which I don't claim to have rigorously tested by any means) [CODE] public static int sumPowers( int n, int m ) { if( m > 0 ) { int sum = n; sum *= sumPowers( n, --m ); return sum+1; …

Member Avatar for Slimmy
0
2K
Member Avatar for by_stander

...as has been pointed out double is different from Double, double is a primitive type, Double is an immutable object, arraylists and other such collections can only accept objects. If using an array is appropriate for the situation then go ahead and use it, if a dynamic data structure such …

Member Avatar for by_stander
0
7K
Member Avatar for ComicStix

Big problem I've seen at universities/colleges compared to back then is students expecting the "teaching" of a subject to be only within the bounds of what is actually delivered within class rather than what is delivered in class being a basis for reasearching and learning on your own. My opinion …

Member Avatar for rscubelek
0
229
Member Avatar for Neversleepin

You have a text file. It is split into lines. You are reading it a line at a time. Read a line and if it starts with S and 2 then ignore it. String.startswith() or something like that. Lookup String class.

Member Avatar for Neversleepin
0
2K
Member Avatar for gooradog

a) 2 power 24 - 1 b) well BCD 4 bits each digit 0-9, work it out, 21 - 0010 0001 c) a bit of a trick question, ACII is used to represent characters not numbers specifically but you can look up the ASCII table and fiddle about but I'd …

Member Avatar for aspire1
0
81
Member Avatar for gooradog

Taking what you've said without any further constraints then interpret it as a poistive base two number, convert it to decimal and that is that.

Member Avatar for aspire1
0
56
Member Avatar for VernonDozier

Yup local variable is getting created. You're not actually modifying anything - java everything is passed by value, a copy is made. So a copy of whatever reference value bytes[] holds is getting made, in this case null and assigned to the local variable bytes in your function. You have …

Member Avatar for VernonDozier
0
216
Member Avatar for plasticfood

[code]if(numList.get(i) == numList.get(j))[/code] You are actually comparing if two Integer objects are referencing the same object. Try numList.get(i).intValue() == numList.get(j).intValue() Couldn't say for sure why the way you are doing it works in some cases.

Member Avatar for plasticfood
0
107
Member Avatar for andyhunter

You have to provide a lower aswell as an upper bound or your expression will return true at the first match e.g //Sanitize salesPersonName first salesPersonName.matches( "[a-zA-Z]{20,20}"); As a tip, it's redundant to be doing the test twice in your code, use a normal while loop rather than do/while.

Member Avatar for aspire1
0
93
Member Avatar for softswing
Member Avatar for ankit.jivrani
0
108
Member Avatar for Sunshineserene

Just use one pass of the bubble sort algorithm as hinted at in the code in previous post. The larget value in the array will be in the last position of the array after one pass, the second largest in second last position after two passes etc..

Member Avatar for Sunshineserene
0
315
Member Avatar for NotThereAnymore

And another variation where index is initially the length of the String: [code] public String reverse(String s, int index ){ if( index >0 ) { return s.charAt( --index) + reverse( s, index); } return ""; } [/code]

Member Avatar for aspire1
0
587
Member Avatar for stevebush

Simple answer - sort your small list using an appropriate algorithm then merge them using an appropriate algorithm and of course you can sort a linked list in less than O(n^2).

Member Avatar for AuburnMathTutor
0
111
Member Avatar for JTroopSoldier

Just my penny's worth - do it if you are genuinely interested in it. Computer Science isn't "all my friends have problems with windows and I fix it for them". Programming is only one area of Computer Science ( all be it important ) and even then, knowing the syntax …

Member Avatar for smokewire
0
220
Member Avatar for iamcreasy

[QUOTE]Isn't 10 instances of Animal class is being created with this line?[/QUOTE] Nope, ten uninitialized reference variables of type Animal are being created.

Member Avatar for NormR1
0
104
Member Avatar for ttboy04

Just out of curiosity, what is the overall aim of the program? Are you trying to generate the power set of an array of values and do you have to use Random? At what point will the program have accomplished it's mission?

Member Avatar for aspire1
0
138
Member Avatar for tennis
Member Avatar for mitch9654

As far as I'm aware applets can't by default write to the local file system: security. Google should show you how to do it.

Member Avatar for mitch9654
0
146
Member Avatar for insanely_sane

This is one version. You might want to look up Generics as of course, only works with int[] [CODE] private static void mergeSort( int[] data ) { if( data.length > 1 ) { int midPoint = data.length / 2; int[] left = new int[ midPoint ]; int[] right = new …

Member Avatar for insanely_sane
0
208
Member Avatar for tam13
Member Avatar for aspire1
0
108
Member Avatar for ChPravin

I assume it means shifting all the elements one place to the right with the last element in the array wrapping around to be the first element in the array with every rotation.

Member Avatar for ChPravin
0
136
Member Avatar for DrApe1

You had the hostname spelling wrong for one thing and your use of Scanner doesn't look right. You program still isn't quite right though. Remember, it's possible to telnet into servers that use "text" format which can help a lot in trouble shooting. [CODE] Socket s = new Socket("time-a.nist.gov", HTTP_PORT); …

Member Avatar for aspire1
0
131
Member Avatar for xenanovich
Member Avatar for ceyesuma

It is used to provide a consistent well, interface, for accessing an object WITHOUT regard to how the actual methods in the interface are implemented. This allows you to swap one class that implements an interface with another that implements it a different way without breaking the underlying logic of …

Member Avatar for ceyesuma
0
115
Member Avatar for socal

You need an empty constructor if you're going to provide your own one and you still want to create a bank account without passing parameters to it: public bankAccount() { } and I'd change the class name to BankAccount as this is the standard way to name classes with capital …

Member Avatar for idlackage
0
101
Member Avatar for SCMAN2010
Member Avatar for aspire1
0
151
Member Avatar for lrolsto1

You'll have to structure your program then so that it's flow of control naturally terminates it. [code] boolean validInput = true; while( validInput ) { // do all the stuff my program is meant to do if user enters invalidInput then display a message validInput = false } [/code] that …

Member Avatar for aspire1
0
78
Member Avatar for lrolsto1

You're checking for null before you've read the next line, a quick change to: while( (currentLine = bread.readLine() ) != null){ //read line by line while should fix it

Member Avatar for BhagatS
0
91
Member Avatar for hsncvs

One way you could go about it: . save the text entered in a String . use the the String split method to create a String[] . create a hashmap HashMap<String, Integer> and add entries to it using the values in String[] as the key with an initial value of …

Member Avatar for stultuske
0
103
Member Avatar for harika.jo

And if they did use that code they won't be graduating from any college soon. It doesn't do a whole lot of much.

Member Avatar for stultuske
0
99
Member Avatar for johndoe444

1. System runs the command and the parent process waits for it to finish. You still have the original process. Exec replaces the current process with a new process. The original process is lost. 2. popen might be what you're looking for. 3. I'd be guessing as to the exact …

Member Avatar for aspire1
0
83
Member Avatar for urbangeek
Member Avatar for bigbags911

Or it can be done quite elegantly using recursion. Easy enough to add the words and lines to an ArrayList too as that seems to be part of the requirement: [code] private static void reverseLines( Scanner input) { while( input.hasNextLine() ) { String line = input.nextLine(); reverseLines( input ); reverseWords( …

Member Avatar for bigbags911
0
2K

The End.