since your input is in the form of
3
10 20 30
you could read the first line and then loop through the second line...
/**code removed by moderator*/
Type: Posts; User: mia_tech
since your input is in the form of
3
10 20 30
you could read the first line and then loop through the second line...
/**code removed by moderator*/
Are you reading from standard input or from a file?
I just figure out what I was missing!
ok I got it, but now I'm trying to output the content of allCust ArrayList and I'm getting nullPointerException.... could someone give me a hint? Thanks
import java.util.*;
public class Main...
how could I use the return of extractCustomers and initialze ArrayList<Customer> in main method?
import java.util.*;
public class Main {
public static void main(String[] args) {
that was kind of strange, since I get no feed back weather my solution is correct or not. Anyways, here it goes again. If someone could take a look at it and let me know if is correct
public...
ok, now I know what spoon-feeding is... I guess by removing my code is a sign that it was correct. Am asking b/c I would like to hear about a better implementation or at least a confirmation that it...
ok I fixed the code, I think it should look like this
/** Code removed by moderator */
guys, why am I getting NullPointerException when initializing the array? I ran debug mode and productName is null
public class Main {
public static void main(String[] args) {
...
this is my implementation, but I'm getting "imputMisMatchException"
public static void mixedF() {
int numbers = 0;
int words = 0;
int num;
try {
...
nextInt() will give you an error once it encounters a letter... how would you handle that?
guys, let's say I have a file that contains
1
33
b s
4
10
f
a
120
After changing type parameters Collections.reverse(pNum); is the way to go
I have imported java.uitl.* which includes LinkedList. May be si b/c I have my own implementation of Stack class, which is basically the same with the basic methods top, pop, isEmpty
that line didn't work... it didn't take a stack!
guys, if you have a stream of numbers: 1 2 20 -4 99 -3 -20. And you need to insert them into an Stack and display the positive numbers in the order they were insert them(if 1 is first, then 1 is...
I'm getting a bunch of strange numbers... I don't think I'm reading the correct input. At the same time I'm getting an outofboud exception. like I'm going beyond the 5 elements of the array
...
guys, I'm trying to read a stream of numbers from standard input like: 2 3 -3 10 44 9 -1. The line ends once it read -1, but for some reason I have an endless loop... how could I read this stream of...
I tried passing the JTextArea in the constructor to IPScanner class, and use setText method from there, but when I do a second scan, it outputs the results from the previous scan plus the new scan,...
guys, I have declare a generic array in OrderSet class; however, during compilation is giving me an error:
Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be...
guys, I know that Stack and LinkedList basically have elements that are compose by the "value" and the "Link" pointing to the next value. Does Set have the same structure?
Thanks
how could I do the last thing you mentioned?
guys, I have a GUI that scan a range of ip address when press "scan" button; however, I'm having trouble displaying the result in the textArea box. I'm using a threads for my execution. here's the...
that's the problem I'm having. I don't know how to initialize a type <T> array. Also, I don't know the size of the array. Is it possible to do?
lets say I want to create a parameterized class
public class MySet<T extends Comparable> implements Set<T> {
T[] n;
MySet(T a)
{