32,204 Topics
| |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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;} … | |
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 … | |
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. … | |
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, … | |
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 … | |
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 . | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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); … | |
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 … | |
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 … | |
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? | |
compare and contrast the latest versions of eclispe, netbeans and jgrasp integrated development environments. | |
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? | |
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 … | |
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 … | |
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 … | |
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. … | |
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 … | |
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 … |
The End.