32,204 Topics

Member Avatar for
Member Avatar for anonb

I am trying to store a file into an ArrayList and then have user input from console search for an element in the Arraylist and return found or not. It keeps giving me -1. public class arrayl { public static void main(String args[] ) throws FileNotFoundException { System.out.println("Please enter title …

Member Avatar for stultuske
0
343
Member Avatar for ct_hunny

hello i have some problem in showing button, when data exist and data not exist. i want the button show if data exist also data not exist. my current problem right now the button only show when data exist but the button automatically hide when data not exist. here what …

Member Avatar for stultuske
0
185
Member Avatar for UNDER-18 FG

I'm trying to write a coding that will be able to determine if a number keyed-in is a Prime Number or not. Here's what I did: public class PrimeNumber { public static void main(String args[]) { int n; Scanner Prime = new Scanner(System.in); System.out.println(" Please enter a number: "); n …

Member Avatar for jalpesh_007
0
698
Member Avatar for jalpesh_007

I have stuck with one problem. I have created my own program that will work. In program there are two for loop. Now my problem is for(int i=0;i<q;i++) { for(int r=0;r<q;r++) { /*perform some kind of operations returns one integer value.*/ /*here q=4 so first time r loop execute 4 …

Member Avatar for jalpesh_007
0
183
Member Avatar for dicauca

Is it possible to make some privileged instructions (eg sti, cli) available via some Java's API? (That is, to build a Java's library that would provide sti() and cli() as static methods) (Suppose this library is buit for a specific machine, not meant to be portable or anything) I've heard …

0
140
Member Avatar for Tomi1988

Hi! Which way is the more effective? Is there any difference? If I give value to a variable in the class public class A{ int a = 3; } or if I give value to a variable in the constructor of the class public class A{ int a; public A(){a=3;} …

Member Avatar for ObSys
0
88
Member Avatar for deadsolo

Hi, I need help creating or manipulationg my current regex that will grab two numbers from a line, while excluding a specific number. Here is an example of what the line will look like: "In our tests, downloads on port 6881 achieved up to 12059 Kbps while downloads on port …

Member Avatar for deadsolo
0
180
Member Avatar for jamesperkins0

Hi guys, i am writing a GUI program that will take a tutor minutes and earings and create an average earnings. My problem is instead of it using what we type in the fields E.g 200 mins and 50 dollars earnt and displaying the average. It shows the default fields. …

Member Avatar for jamesperkins0
0
231
Member Avatar for Dane2259

I'm trying to do a quickSort with a Doubly LinkedList. I can partition the original list into a lower and upper sublist, but have been unsuccessful going any further. Below is the code for the class DoublyLinkedList. The methods that perform the quick sort are at the bottom (partition, recQuickSort, …

Member Avatar for Taywin
0
727
Member Avatar for subrat_p

I have a textfield, and that only accept integer numbers. If user input charter type value it shows JOptionpane Error Message and when user click on the ok button in optionpane message the textfield clear itself public void nosgetit(DocumentEvent documentEvent){ DocumentEvent.EventType type = documentEvent.getType(); if(type.equals(DocumentEvent.EventType.CHANGE)){ } if(type.equals(DocumentEvent.EventType.INSERT)){ String ns=nos_txt.getText(); char …

Member Avatar for JamesCherrill
0
548
Member Avatar for pooran.c

int [10] array_int=new int [10]; array_int[0]=0; array_int[1]=1; array_int[2]=2; array_int[3]=3; array_int[4]=4; array_int[5]=5; question is: how to print in circular manner starting from the middle(index is 2) that is output : 2 3 4 5 0 1 .

Member Avatar for stultuske
0
364
Member Avatar for aravind326

Hi, I am just trying to do some program on arithmetic expression parsing. So i want to store my operator precedence table in the program somehow. I could use a multidimensional array, but that would be inefficient i guess. Another idea i have is to use a HashTable, where the …

Member Avatar for aravind326
0
451
Member Avatar for ahmedhesham

1. Rational Implement a rational number class: Rational Augment your class with methods for: a) Initialization (Constructor): parameters are numerator and denominator as integers. You must have 3 constructors as follows ï‚· No Parameters: 0 / 1 ï‚· One Parameter (x): x / 1 ï‚· Two Parameters (x, y): x …

Member Avatar for jalpesh_007
-1
140
Member Avatar for liz.willy
Member Avatar for System Networks

Hi, I have a jar which cannot be accessed by double clicking on it(I don't know why) but can be opened through the terminal. I just have to put java -jar "myJar.jar" And all the fancy things on the consoles appears then your application appears. I'm planning to release my …

Member Avatar for stultuske
0
119
Member Avatar for hwoarang69

so i have a interview on data structures. i am sure they will ask question on 1d arrays. but what can they ask me? 1.give a array find the max and min value. 2.give a array find avg. 3.sum of all value in array 4.... what else can they ask …

Member Avatar for jalpesh_007
0
177
Member Avatar for Syrne

Hi there, I'm new to tree maps and I am trying to write my own version of the pre-defined "remove" function for Tree Maps. I know I need to have two extra functions that find the minimum and maximum values in the map that will be called within the remove …

Member Avatar for ekemaz11
0
250
Member Avatar for london-G

Hello. I have a tablw which holds quite a lot of information, I would like to print the table in landscape. try { boolean complete = Table_Stud.print(JTable.PrintMode.FIT_WIDTH,header,footer); if (complete) { JOptionPane.showMessageDialog(null, "printing...."); } else { JOptionPane.showMessageDialog(null, "Cancelled!"); } } catch (PrinterException pe) { /* Printing failed, report to the user …

Member Avatar for mKorbel
0
779
Member Avatar for jayl935

Howdy. Instead of displaying text for a few seconds using toast, I would like to display it permanently. At first, I thought toast would be better, now I can't figure out how to simply display it. Here is the toast code: public void onClick(View arg0) { gps = new GPSTracker(TrackingActivity.this); …

0
82
Member Avatar for sheushen

I need to sort the display by name in alphabetical order. How do I do that? public class Node { String name; int age; String position; int salary; String num; Node next; Node() { name = null; age = 0; position = null; salary = 0; num = null; next …

Member Avatar for Taywin
0
200
Member Avatar for BLuv

Hi everyone, I am brand new to Java and I like it a lot so far. I am very stuck on an assignment for school that I need help with. We are just learning about method invocation, how to write and call methods in Java. My program should take user …

Member Avatar for Taywin
0
182
Member Avatar for Kathy0410

Is there a way to modify the bubble sort algorithm so that it will stop as soon as it recognizes that the list is sorted?

Member Avatar for JamesCherrill
0
90
Member Avatar for HankReardon
Member Avatar for stultuske
-2
157
Member Avatar for OsaidAz

ok, so I have two classes: Ticket and passenger passenger class has 3 data members, and one the the ticket data members is: `private Passenger psmgr;` what I want to do is to access passenger's data member using the psmgr variable how do I do that?

Member Avatar for OsaidAz
0
234
Member Avatar for IcyFire

Is there a way for me to manipulate the cells of a grid layout? For example lets say i have a grid that has 5 rows and 5 columns. Is it possible for me to manipulate the cell at row 1 column 2 using the layout, sort of like the …

Member Avatar for IcyFire
0
214
Member Avatar for rahul.ch

List<? extends Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); List<? super Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); For the first three lines as Case 1 using extends it compiles fine. But for Case 2 of next three lines, it …

Member Avatar for rahul.ch
0
2K
Member Avatar for Monkey101

Hello everyone, I am confuse to what my professor is asking for Part 4 of our project. --> The fourth method for you to develop must manipulate the Colors within a given box. To compute how much manipulation to do on a Pixel from its LOCATION (x,y), the function defined …

Member Avatar for Taywin
0
105
Member Avatar for sobias

Hi guys, I'm trying to solve a problem recusrively. I'm asked to multiply two numbers with only using Addition,Subtraction and Comparison. After looking around the internet, it seems that the Algorithm I should use is Egyptian Algorithm . [Click Here](http://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication) I would like some tips on how to solve this. …

Member Avatar for sobias
0
1K
Member Avatar for tarareddy

i found this code for pacman i want some one to explain me how it works i am new to java game programming so my doubts might be silly for few of u i just understood the array part of creating the maze i have written all my doubts thank …

Member Avatar for tarareddy
-1
6K
Member Avatar for yen.ho.100

Hello everyone, I am pretty new to java and i have an assignment that to write the code for clock in and clock out for employee .Down here is my code, and now i am stuck with the while loop to print out the name, like if Bob work on …

Member Avatar for stultuske
0
88

The End.