- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 293
- Posts with Upvotes
- 273
- Upvoting Members
- 131
- Downvotes Received
- 22
- Posts with Downvotes
- 21
- Downvoting Members
- 17
Web developer
- Interests
- Anime, Manga, Fencing, Formula 1 (Ferrari rules), java, Magic the Gathering
1,963 Posted Topics
Re: I drink hot chocolate while I am writing code, and potato chips with coke when playing video games | |
Re: [QUOTE=pabs31;301752]Try this out then: 1. Click Start then Run and type in cmd then press Enter...this will bring up command prompt. 2. in command prompt type ipconfig /flushdns (you will get a message saying successfully flushed DNS) 3. type exit and try browsing again If this does not work than … | |
Re: [QUOTE=masijade;1062384]Manual. Gives full control with no "bolierplate", repetitive, rigid code. But that's not what you're looking for is it? I dislike [i]all[/i] "Gui builders", as they all produce rigid, reptitive code that is hard to modify correctly, and is not always that effecient when any action to be performed is … | |
Re: [QUOTE=ramborambo;867297]Do it yourself!![/QUOTE] That was very rude. You judge others when yourself have created 2 identical threads with the same question. | |
Re: *saadismail85* please use code tags and/or start a new thread. For code tags click the button: (code) when you write your post | |
Re: That you want in the way you want it cannot be done. If you want to call a java method, after the page has rendered, by clicking a button you need to submit the form, to a servlet or jsp (preferably a servlet) and there you can call your java … | |
Re: You should add to your pages code that checks the session. If it doesn't contain the user information redirect to the login page. The user can go directly to whatever page they want by providing url at the browser. [U]Then[/U] you need to check if there is a session with … | |
Re: [QUOTE=itovin;1216633]pano po gawin sa java yung kunyare nag-enter ako nang number tapos ang lalabas asteris(*)[/QUOTE] Start a new thread. | |
Hi All. This is my first code snippet. I don't know how practical it is, but I came up with the idea, so I wanted to do it. Assuming you have an array. You use a for loop to display its data. For 2D arrays you use 2 for loops. … | |
Re: Do you know how to run queries with java and how in general to insert data in a database? There are several ways so can you post the code that use to insert normal data, so we can give you a suggestion similar to your code style? Do you use … | |
Re: Are you talking about localization where you can change the labels of your page to the language of your choice, or you want the user to enter a word and the page will translate it? | |
Re: Your question doesn't make any sense. Post an example, read about javascript | |
Re: I believe that the request.getParameter("test") will give you the value "1", not the "Hi". Why do you think that it is not working? | |
Re: The Person class is abstract. So the classes that extend Person must implement all the abstract methods of Person. The classes: Students and Lecturers must implement the method getRegisterNo() . You have forgotten to implement this method when you did: Students extends Person | |
Re: Why don't you try the API for String, and the methods indexOf. If it returns something not -1 then increase a count++ and search for the occurrence of the letter after that index. | |
Re: > Pls help urgently, i want to read text files from directory but keeps giving me 3 errors C:\Users\teejay\Documents\OneFile.java:52: reached end of file while parsing } C:\Users\teejay\Documents\OneFile.java:18: 'try' without 'catch' or 'finally' try{ //read one text file C:\Users\teejay\Documents\OneFile.java:18: 'try' without 'catch' or 'finally' try{ //reached end of file whele parsing. … | |
Re: [QUOTE=mrabrar09;1740430]Actually i have written a small program on division, now i want see the control flow means how the line of code is executing and calling the methods and function step by step. But when am run the program in debug mode nothing is showing[/QUOTE] You must first place a … | |
Re: Inside the run method of the Thread class have a boolean method take value true when it finishes. That variable will be declared as an attribute of the class. When you call the thread have a while loop checking that variable when it becomes true you will exit the loop | |
Re: [QUOTE=mudasir rashid;1463586]send me the code of these Using two dimensional array in java write program to print following Pascal triangle. 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1[/QUOTE] We don't give away code. We help those who are willing to learn. Start a … | |
Re: Have a variable that counts how many times the password has been entered. When the password is wrong increase its value and put its value to a hidden field so to get it at request when the form is submitted again the next time. | |
Re: Any beginner's java book has examples on how to create gui using javax.swing.If you don't have already such a book search the internet for tutorials. And check the java API for the following classes: JFrame, JPanel, JTextField, JPasswordField, JButton, JLabel And the interface ActionListener | |
Re: java DooBee at the cmd to "run" the file .class | |
Re: Change this: [CODE] System.out.println( " Please enter number of rows in integer type "); try { String MAX_ROWS = stdin.readLine(); } catch (IOException e) { e.printStackTrace(); } [/CODE] To This: [CODE] String MAX_ROWS = ""; System.out.println( " Please enter number of rows in integer type "); try { MAX_ROWS = … | |
Re: [QUOTE]FirstAglet.java:3: package com.ibm.aglet does not exist import com.ibm.aglet.*; ^[/QUOTE] Do you have the package where the aglet is implemented: com.ibm.aglet ? You need to get the jar file of the package or the class files in order to be able to import them. The program of your friend runs because … | |
Re: First of all, in the ImageIcon method you pass the filename as argument and then you set it to "" . Why? Just pass the argument to the constructor and create the image. Why do you "delete" the argument by doing this: filename = ""; And since you have the … | |
Re: You can use BufferedWriter to write to a file: [CODE] FileWriter fWriter = null; BufferedWriter writer = null; try { fWriter = new FileWriter("fileName"); writer = new BufferedWriter(fWriter); //WRITES 1 LINE TO FILE AND CHANGES LINE writer.write("This line is written"); writer.newLine(); writer.close(); } catch (Exception e) { } [/CODE] Also … | |
Re: Check the API for the String class. There you will find many useful methods | |
Re: Hi, You cannot call a java class if it doesn't have a main method. In the code you posted there is this line: // public Static Void main (String args[]){} (Static needs to change to static) When you run a java class: E:\sher\SkyDrive\Exercise Files\L04>java Student Its main method is called. … | |
Re: If you read the messages they tell you at which line you get the error and what the error is. You are using something which is null | |
Re: Assuming you something like this: [CODE] public class Calculator { public static void main (String args[]) { String exp = JOptionPane.showInputDialog("Enter mathematical expression: "); exp = infixToPostfix(exp); JOptionPane.showMessageDialog(null,"Postfix expression: " +"\n"+ exp); } public static String infixToPostfix (String infix) { (some codes here)......... else { JOptionPane.showMessageDialog(null, "Invalid expression."); System.exit(0); } … | |
Re: Your code is correct with the difference that you need to call the **nextLine**: Scanner sc = new scanner (file); while (sc.hasNext()){ String data = sc.nextLine(); String[] val = data.split(","); System.out.println(values[0] + " " + values[1]); } | |
Re: Can you post some code? Have you tried debugging your code by adding some System.out.println messages to see what is happenig as the code runs? | |
Re: Hi everybody, I also have a question related to this matter and I hope I am not out of topic. Me and a friend of mine bought a year ago new PCs with Vista installed. He is been telling me that he wants to upgrade to Windows 7, but I … | |
Re: Hi let me give you an example about the default constructor. Suppose you have this: class MyClass { public String a = null; } You can instantiate it like this: MyClass cl = new MyClass(); You haven't declared a constructor so it will use the "default". A no-argument constructor. If … | |
Re: From what I see, you have your code in the readCustomerData method. Every time you call it, new data will come in the ArrayList. Also you don't use the argument of the method. I don't know if this is what you want, but if you want to have the ArrayList … | |
Re: [QUOTE=baneyramos_09;1321173]? missing return statement! hi guys, Im trying to compile this class below, but its just not working, it keeps sating 'missing return statement' int the method declaration line. Can u see to check if there is anything missing in my code or if iv done something wrong?? Thanks! public … | |
Re: You can do this with IFRAME. You can add an onclick event at the link. When that link is clicked execute a javascript method. In that method you can take the iframe and set its src (source) with that page: [CODE] <IFRAME name="yourIframe" id="yourIframe" src="empty.jsp"></IFRAME> [/CODE] Create an empty jsp … | |
Re: For writing I use this: BufferedWriter, FileWriter: [CODE] BufferedWriter wr = null; try { wr = new BufferedWriter(new FileWriter("Exercise09_19.txt")); wr.write("something"); } catch (Exception e) { System.out.println(e.getMessage()); } finally { if (wr!=null) wr.close(); } [/CODE] The BufferedWriter is declared outside the try, in order to be "visible" in the finally when … | |
Re: You need first to populate all the array and then sort. What you do is this: [CODE] for () { array[i] = number; sort; } [/CODE] But with that you put the first number and you sort an array that has only 1 number. Then you add a second number … | |
Re: Delete everything you have done because they are wrong. From the code, are you saying that you have a ResultSet in the jsp so you are calling the database from inside a jsp? That is wrong. Create a method, execute the query inside that method and return an array or … | |
Re: [QUOTE=stopah2008;630333]Could someone help java code to read number of lines, words and characrters in paragragh .[/QUOTE] You can count how may times the \n appears in the paragraph for lines. For characters the total length of the paragraph String minus the characters: " ", " ", " ", ... For … | |
Re: What errors do you get? Does the program compile, run? Do you get the desired results? | |
![]() | Re: Where do you want to be printed? I would suggest to have a button with each row that has that "onclick" event. When the rows are dynamically created you can have the value you want to be printed passed as a parameter at a method in the "onclick" event. I … |
Re: All I would do is create a separate thread and start it whenever I want: [CODE] class MyThread extends Thread { } [/CODE] [CODE] MyThread mt = new MyThread(); mt.start(); [/CODE] Now in the run method you can try something like this: [CODE] int count = 0; while (count<10) { … | |
Re: [QUOTE=jimmylee;1009950]How do I convert the Integer to String by: 1. Asking the user to input the number (Eg: 704 = Seven Hundred and Four) 2. Display the output in JTextArea. Thanks for your support.[/QUOTE] Start a new thread. This is a 3 year old thread. | |
Re: [CODE] public class Dice { public static void main(String[] args) { // Welcome message. System.out.println ("Welcome to The Dice Roller Game!"); // Roll the dice. int die1, die2; int rollcount; rollcount = 0; int wins = 0; Scanner keyboard = new Scanner(System.in); int userinput=-1; do { die1 = (int)(Math.random()*6) + … | |
| |
Re: This is part of the stack trace: BasicTreeUI.paintRow(BasicTreeUI.java:1399) It means that at the file BasicTreeUI.java, you have an Exception at line 1399 (function paintRow). You are trying to use something that is null. | |
Re: Just loop the array or the ArrayList until you find the element that is equals with the input. If you are using Strings use the equals method. If you find it return the index of the for loop. If the loop finishes without finding anything return -1 | |
Re: When you use: [ICODE] for (int i=0;i<length;i++) [/ICODE] And others use: [ICODE] for (Object o:array) [/ICODE] |
The End.