35,618 Topics
![]() | |
Hey guys im making a simple program. I have a while loop that continues while the bool quit ! = true. I am trying to test that in a statement like this: [CODE] String userdecision = ""; while (quit!=true){ //start while System.out.print("Would you like to continue with another transaction?"); [B]userdecision=in.next();[/B] … | |
code:: [code] import java.io.*; import java.util.*; public class Global{ public static int flag=0; } interface filebackedfifoqueue { void put(String msg); String get(); } public class trying{ public static void main(String args[])throws IOException{ int ch=1; String msg; msg = new String(); while(ch!=0) { BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); System.out.println("\nMenu"); System.out.println("\n0.EXit"); System.out.println("\n1.Publisher"); System.out.println("\n2.Subscriber"); … | |
Hi everybody, I want to have a login form in Java, which comparing the username and password, according to MySQL database data, so I have the following code, just don't know where to add the select statement and how verify the username and password from MySQL with the JTextfield of … | |
Hello Everyone, Few days ago, There was active thread on creating own DBMS in Java. Its not an easy task so i decided to create Object-Relational Mapping Framework and i have done so. I have tested all methods and its working perfectly. Now i have decided to make it available … | |
Hello, I'm creating a program that involves coloring an image thats is gray scaled and has a transparent background. How do I do that? | |
Which is in higher demand in the job market right now??? | |
I am doing a Java project and in my gui I want to use Buttons. I want to put a class' internal parts code as a button action. Because the class Throws Exception when I copy the contents of the class under the button definition I encounter unreported exception error. … | |
hi Frends, I am a NetBeans user, I show an error in My project when i click on Design view of JFrame. Error is:-"The File Formate is Not Recognized" this is my project database's JFrame. i can't see the design view but ican write code in it. In code window. … | |
hi guys, how to make frames, or windows in a shape of circle or something not in regular rectangular?? Thanks in advance. | |
I have two strings s1 and s2. I have to check what is the largest occurence of letters in s2 that are in s1. For example: s1="xyz" s2="abxyryxzycx" it would then return 4 since "yxzy" is the largest substring with all the letters in s1. It has to be recursive. … | |
Hi All I've created a web page where I'm trying to pull data from the database. My requirement is to populate a combo box from the database automatically, i.e. as and when the db updates, the combo box needs to get updated. I have heard that it's possible with Ajax. … | |
How do you convert a character type into a string type?? | |
[CODE] import java.io.*; import java.util.*; public class Palindrome { public static void main(String[] args) throws IOException { char letter; String reversed,NEW; Stack S = new Stack(); BufferedReader stndin=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter a word: "); String word=stndin.readLine(); for(int i=0; i<word.length(); i++){ letter = word.charAt(i); //this line should cut the 1st letter … | |
Hi! I am trying to initiate a client-server talk but for some reason it is not working. The server starts running, but when I start the client nothing happens. Please point out the mistake in my code- Server- [code="java"] import java.io.*; import java.net.*; public class MyServer { public static void … | |
I have a Set that contains different random lines from a text file, now I'm new to Java so I don't know much about the methods available but I have tried using the java.util.Set.toArray() method but it returns an Object[] than can not be sorted. Is there anyway to do … | |
hey! I`m a beginner in Java and I want to write a program that use try and catch method to send a msg if the average it calculate is not in [0-20] I have already write this code but it always print 0! what is wrong with my code?!!! [ICODE]using … | |
I made this applet for my APCOMPSCIA class, it due tomorrow but I cant get it working. I need to show the animation of a sort, but it just does sort once that it, please help. I will be very great full. [CODE]import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Random; … | |
can anyone tell me the code how to create a textpane with scrollbars inside a tabbed pane.....and i should save the text in a file on button click.... | |
[code=java] import java.util.Scanner; import java.util.regex.*; import java.io.*; import javax.swing.*; /** * A program that parses a user-supplied URL */ public class URLParser { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); PrintWriter out = new PrintWriter(new FileWriter("D:\\cs2200\\lab8\\URLs.txt")); String input=""; // Everything works the way I … | |
Hello, I am creating a client/server application that verifies math equations for addition, subtraction, and division. I think I just need someone else’s eyes to possibly see where I am going wrong with this. Everything seems to be working fine except for one variable. This is the String serverAnswer variable … | |
I have all my code for this. I have the code to read a txt file, write a txt file, convert the infix to postfix and evaluate it. I am now just having trouble putting it all together. I need it to read the text from a file convert each … | |
[code=java] import java.awt.EventQueue; import javax.swing.JFrame; public class tatat extends JFrame { private static final long serialVersionUID = 1L; public static void main(String args[]) { EventQueue.invokeLater(new Runnable() { public void run() { try { tatat frame = new tatat(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public … | |
[code] import java.io.*; import java.util.*; import java.io.IOException; import java.util.Scanner; public class Lab { public static void main(String[]args) { System.out.println("MAIN MENU"); System.out.println("<1> Bahasa Melayu"); System.out.println("<2> English"); System.out.println("<3> Exit"); System.out.println("Your selection (1,2 or 3)?"); Scanner read = new Scanner (System.in); int selection = read.nextInt(); if(selection == 1) { System.out.println("Hello, apa khabar?"); } … | |
Implement a subject scheduler using the topological sorting algorithm. The program shall prompt for an input file containing the subjects in the set and the partial ordering of subjects. A subject in the input file shall be of the form (number, subject) where number is an integer assigned to the … | |
[CODE] import javax.swing.*; public class A { public static void main (String args[]){ String ask = JOptionPane.showInputDialog("Enter"); if(ask.equals("hello")){ System.out.println("ok."); main(args); }else if(isRepeat(ask)){ System.out.println("Invalid,string has been repeated."); System.exit(0); } } public static boolean isRepeat(String ask){ if(ask.equals("hello")){ return true; }else{ return false; } } } [/CODE] Hello, I am having problems with … | |
![]() | i cant figure out what's wrong with my code. can anyone help me pls? [code] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class MyGUI implements WindowListener, ActionListener { public void windowClosing(WindowEvent e) { System.exit(0); } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowOpened(WindowEvent … ![]() |
In a queue, where elements in integers are added, how do i do this: Inside the queue: 1 2 3 5 6 8 when I want to add a number, say 4, the output should be like: 1 2 3 [B]4[/B] 5 6 8 in which it inserts in between … | |
Hi, I'm trying to program Tetris. The thing is, I can't seem to get the Keylistener to work in the JApplet, and I have no idea why :( Here's my code: [CODE=java] import java.util.Random; import java.awt.event.*; import java.awt.*; import javax.swing.*; /** * Class Tetris - write a description of the … | |
Hi, I'm working on an algorithm that solves a maze from the inside, and seeks out 1 of the 4 exits on the sides, and after getting 1, it goes to the next until it has them all. The maze is always 22x22, and you only have 400 steps. I … |
The End.