32,199 Topics

Member Avatar for
Member Avatar for OVOXO

So I'm looking for a way to assign a set of numbers in a random way in a 2d array. The array is {1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10} How would I assign these values randomly in a 5 row and 4 column array? Or is there a way to generate a random number for …

Member Avatar for dmanw100
0
119
Member Avatar for gourav1

my question is that can we send e-mail through code written in java? i know that it can be made in php but don't knoe about java...if answer is yes, then can u give me hint that how to proceed means what to use(API, servlets or jsp or link from …

Member Avatar for stultuske
0
368
Member Avatar for nyaneshi

I am a first year I.T student. We haven't really been taught PROPERLY about throws Exceptions and FileReaders. So I need help, why my program keeps telling me I have a InputMismatchException? Netbeans doesn't show any errors in my codes. and i just added a Method for Lowest Grade[since that's …

Member Avatar for NormR1
0
118
Member Avatar for Majestics

Its a simple problem... I placed the socket code under a button, if server is present it respond very quickly if not it takes time to respond.... I want to shorter that time , is there any way?

Member Avatar for ~s.o.s~
0
796
Member Avatar for vaironl

Hello forum, Vaironl here. I have a small question, I'm making a new screen using the GridBagLayout, since my old screen was using absolute positioning. I'm using a JScrollPane and setting a subPanel in it. THe subPanel contains 40 labels saying Ingredient. For some reasong the Ingredient Scroller will take …

Member Avatar for mKorbel
1
998
Member Avatar for new_2_java

Hello folks, I am trying to add a JFrame object into JTabbedPane, but I am getting a java.lang.IllegalArgumentException. Here's my code snipt. [code] // other codes... JTabbedPane tabs = new JTabbedPane(); tabs.addTab("Flight Information",flightInfoPane); <-------------- line 28 // other codes... private FlightInfoPane flightInfoPane = new FlightInfoPane(); [/code] Here I have flightInfoPane …

Member Avatar for test.tracker
0
845
Member Avatar for sirlink99

I was watching a video on how they made Watson (the robot that was on jeopardy), and another one where a person made a simulation where triangles (animals) learned when to get food, and such, and then taught their offsprings, and then they learned more, and then the intelligence developed. …

Member Avatar for harinath_2007
0
174
Member Avatar for asif49

Suppose you have a supermarket, and every item which belongs in that supermarket is stored in one place. Then you have sections of the supermarket like "Food & Cuisine", "Entertainment" and so on. The user of your program needs to be able to list every item within the supermarket, then …

Member Avatar for asif49
0
214
Member Avatar for krishnisilva

hi, [CODE] public Record get(VideoObj v) { // TODO if((v ==null) || (v=="")) return null; else return ??; } [/CODE] Recor and VideoObj are classes. if the methos return type is Record, can someone tell me what should I return? thanks

Member Avatar for stultuske
0
229
Member Avatar for sirlink99

I am making a java game, and I have heard that when I use the Math.random() method it has greater chances of generating some numbers. is this true, and if so how can I fix it. If not which method generates numbers unequally? Thanks for your help.

Member Avatar for sirlink99
0
3K
Member Avatar for toferdagofer

I am trying to compare two arrays of objects to verify that they have the same values. It is returning false when it should be returning true. Im not sure what I am doing wrong when comparing the two arrays. Class : arrayObject [CODE]import java.util.*; public class arrayObject { private …

Member Avatar for mcriscolo
0
2K
Member Avatar for sha11e

I have seen some people talking about it and my question is... I have a program that opens a input and output stream, when the program gets the message '#end' it should terminate the program. Does it really matter if I close the in-and output streams and then close the …

Member Avatar for JamesCherrill
0
130
Member Avatar for CodeJava1

could some one explain the code below [CODE]import java.util.Map; import java.util.HashMap; import java.util.Collection; import java.util.ArrayList; final class InventorySet { /** @invariant <code>_data != null</code> */ private final Map<VideoObj,Record> _data = new HashMap<VideoObj,Record>(); InventorySet() { } /** * Return the number of Records. */ public int size() { // fill in …

Member Avatar for CodeJava1
0
249
Member Avatar for Joshua73

Hi i am doing a student grade lab where the student enters a grade they got on a test and they get a letter grade. My program only gives the user a F even if it should be another grade. This is my code. [CODE]strT1 = JOptionPane.showInputDialog("Enter 1st test score:"); …

Member Avatar for stultuske
0
258
Member Avatar for Joshua73
0
81
Member Avatar for Rasmalai

the following program uses 2 arrays a & b of sizes m & n, both the arrays take values from user. third array is of size m+n. i hv to merge these two arrays into third one. but becoz of 1 error i m unable to do this. i hv …

Member Avatar for Rasmalai
0
146
Member Avatar for boris90

I have this code: [CODE] /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package se211.dz14; import java.util.Scanner; /** * * @author Boris */ public class Month { /** * @param args the command line arguments */ public static void …

Member Avatar for boris90
0
224
Member Avatar for sharathg.satya

hi all Here i am trying to a code in which the run method is not being called when the thread is started.. Can anyone help me please.. Here is my code [CODE]import java.awt.*; public class Games extends Frame implements Runnable { int x=250,y=470; Thread t=new Thread(); Games() { setVisible(true); …

Member Avatar for sharathg.satya
0
2K
Member Avatar for vinay.tmr
Member Avatar for jwenting
-1
2K
Member Avatar for riahc3

Hey I want to create a JAR library but not sure how to in MyEclipse. Im currently doing it manually using jar command but I cant seem to get it correctly The library code is: [code] public class LibAdd { public static int addtwonumbers (int a,int b) { return a+b; …

Member Avatar for riahc3
0
176
Member Avatar for wallet123

[CODE]class DoWhileDemo { public static void main(String[] args){ int count = 1; do { System.out.println("Count is: " + count); count++; } while (count <= 11); } }[/CODE] can someone please rxplain to me how does Do while statements work? and how can i use it in my program?: [CODE]public static …

Member Avatar for stultuske
0
132
Member Avatar for wallet123

im trying to do a program like this: i need to do a program like this: Automatic Teller Machine [B] Balance [D] Deposit [W] Withdrawal [Q] Quit select you OPtions: once i have chosen an option then i should proceed here if i choose b: YOur Balance is __ if …

Member Avatar for wallet123
0
96
Member Avatar for xxvicoxx

Hello guys well I have been working in this arraylist that is now driving me crazy! Bascially I wrote a CAR class which has some methods in it, however now I created an arraylist so it could store cars from the other class and at the same time have access …

Member Avatar for jeff-fisher
0
1K
Member Avatar for ajacintha

I am new to Java Swing, I have created a JFrame which should get displayed when there is mouse focused over it and should be hidden when the mouse is not over it. Should i add a window listener for it.

Member Avatar for JamesCherrill
0
218
Member Avatar for adarshcu

Hi, I'm not quite sure if there is a thread for Eclipse related query separately. But since this is a java related one. I'm posting it here. Is it possible that i can have PMD check run on a project by default ? Instead of clicking on my source file …

Member Avatar for DavidKroukamp
0
140
Member Avatar for ajacintha

I have created a frame , which cannot be maximized , but i want to make the frame non drag gable, want the frame in fixed position.

Member Avatar for dmanw100
0
83
Member Avatar for rhfh

Hi everybody, Good morning...need to ask some question.. Below is my code for the cinema booking system. [code] import java.util.ArrayList; import java.util.Hashtable; import java.util.Scanner; public class CinemaBooking { final int rows = 7, cols = 4; char[][] seats = new char[rows][cols]; ArrayList<String> reservedSeats = new ArrayList<String>(); public static void main(String[] …

Member Avatar for mcriscolo
0
172
Member Avatar for Empireryan

Greetings all. I'm preparing for my java data structure/algorithms class and I'm starting a personal code repository of sorts and such. I started out with c++ and my question is this: I'm implementing a controller class and a class full of sorting and search methods in java. Instead of copying …

Member Avatar for dmanw100
0
2K
Member Avatar for sirlink99

I have this line of code (repeated with a bit of change) [CODE] if (ropeChosen == 1){ g.drawImage(rope, 321, 0, 10, 505, this); g.drawImage(rope, 521, 0, 10, 704, this); g.drawImage(rope, 721, 0, 10, 703, this); g.drawImage(rope, 921, 0, 10, 702, this); if (p.idol2){ g.drawImage (idol, 275,485,100,100,this); }else{ g.drawImage (snake, 300,505,50,100,this); …

Member Avatar for sirlink99
0
109
Member Avatar for curtissumpter

[code=java] final String cardListStrings[] = {"First Card", "Next Card", "Previous Card", "Last Card"}; cardList = new JList(cardListStrings); cardList.setVisibleRowCount(4); cardList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); cardList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { System.out.println("Inside List Event Handler"); if (cardList.getSelectedIndex()== 0) { cardManager.first(deck); System.out.println("First Card"); } if (cardList.getSelectedIndex()== 1) { cardManager.next(deck); System.out.println("Next Card"); } if (cardList.getSelectedIndex() …

Member Avatar for DavidKroukamp
0
220

The End.