35,618 Topics
![]() | |
[code]public class Test { public static method1(int n, m){ n += m; method2(3.4); } public static int method2(int n){ if (n > 0)return 1; else if (n == 0) return 0; else if (n < 0) return -1; } }[/code] | |
[CODE]public static Integer calcs(String postFix) { StackInterface<Character> stack = new LinkedStack<Character>(); // instantiate Character stack Integer result = new Integer(0); Node<Integer> num1, num2; Integer int1 = new Integer(0); // declare address to each variable object Integer int2 = new Integer(0); num1 = new Node<Integer>(int1, null); num2 = new Node<Integer>(int2, null); … | |
Hello, Is it possible for anyone to explain to me what "Initialize the 3 parallel arrays" means? Here is the problem. A file called seats.txt contains a description of an airline seating arrangement and a list of individual seat assignments. An example is shown here: rows 7 leftSeats 1 rightSeats … | |
[code] import java.awt.*; import java.awt.event.*; import java.sql.*; import javax.swing.*; import java.util.*; public class attendance extends JFrame implements ItemListener, ActionListener { static Connection con; static Statement stmt; static ResultSet rs; static ResultSetMetaData rsMeta; String query; String ref="",rollno=""; String[] heads; int[] stChange; String[][] cubeData; int rows, cols, coo; public attendance(String tit, String … | |
Dear All I am a newbie Java Learner.I try to learn over Java API Docs.But still I need some help. I have a gui which consist of four textfields(tf1,tf2,tf3,tf4) and a button(b1). If I press the button(b1)"Register", I want my action write whole textfield sources into a text.txt file by … | |
Hai, I am new java developer. Now i am doing one struts application. In my application, at the User registration time, i need to Encrypt the password field and then i like to store into the database. After that the same user will be logging, at the moment the database … | |
Hi! The problem is connected with using frame.pack(). So, let's say there is JFrame: frame. Depending on the option selected from JComboBox, the content and size of JFrame should change. Everything works perfectly in NetBeans (!!!). However, if I try to run the JAR file, then the size of JFrame … | |
I am writing Spring web MVC app whereby the client and the server communicates by sending json messages. On the client I am making asynchronous calls to update textboxes. Could you please let me know if I am using the right syntax? I have hit a brick wall and cannot … | |
Hello, I am trying to create an IRC server. The thing is that I dont want this server to run on "localhost", I want to connect this server to other upstream IRC servers. I dont know how to do that. I.E. I want this server to connect to smth.hostname.com on … | |
I wrote a simple HelloWorld programe looks like something this: import javax.swing.JOptionPane; public class HelloWorld { public static void main(String [] args) { JOptionPane.showMessageDialog(null, "Welcome"); } } ----------------------------------------------------------- In this simple java programe which in not an applet I just want to print the "Welcome" message in some other fonts … | |
My code is : [CODE] public final class Pixels{ BufferedImage img=null; public int w,h; public Pixels(){ try { // Read from a file File file = new File("1.jpg"); img = javax.imageio.ImageIO.read(file); } catch (IOException e) { } } public void checkfunction(){ h=img.getHeight(); // errorpoint w=img.getWidth(); } [/CODE] Errors: Exception in … | |
I'm trying to implement a gap sort which is a bubble sort that instead of comparing neighboring elements to sort a list, it compares elements 'i' positions apart. I can get the sort to execute the loop once, but I can't figure out how to make my program continue looping … | |
![]() | Hi I wrote a litle code to calculate factorial, but when I compile it, it says " ';' expected " (In the " for ") Here is my code : [CODE] /** * A class to calculate factorial of a number * * @author Barth * @version 10/29/10 */ public … ![]() |
HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: File "/WEB-INF/struts-html.tld" not found org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116) org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:430) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:499) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1558) org.apache.jasper.compiler.Parser.parse(Parser.java:130) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245) org.apache.jasper.compiler.ParserController.parse(ParserController.java:101) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:176) org.apache.jasper.compiler.Compiler.compile(Compiler.java:317) org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) note … | |
HTTP STATUS 500 PLEASE HELP ME description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.lang.NullPointerException org.apache.jsp.janki.bsal_005fsearchresult_jsp._jspService(bsal_005fsearchresult_jsp.java:107) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the … | |
[CODE=JAVA] setFoo(getFoo() + 1); ... private int foo; public synchronized int getFoo() { return foo; } public synchronized void setFoo(int f) { foo = f; } [/CODE] Easy code for a race condition. Easy solution: [CODE=JAVA] synchronize(o){ o.setFoo(o.getFoo() + 1); } ... private int foo; public synchronized int getFoo() { … | |
I have wrote a simple java programe whose code is as fallow: [code] import javax.swing.JOptionPane; public class HelloWorld { public static void main(String [] args) { JOptionPane.showMessageDialog(null, "Welcome"); } } [/code] ------------------------------------------------------ Now I just want that the message "Welcome" to print in differnet size and color. Please help me … | |
i want to make my java project with Jmonkey, is it easier than using eclipse alone? | |
I want to create payslip in java [CODE]public Vector createData() { Vector result = new Vector(); Vector rec = new Vector(); Object[] value = new Object[] {"Employee Name",ename.getSelectedItem().toString()}; rec.add(value); value = new Object[] {"Mary-Kate Olsen", "Ashley Olsen"}; rec.add(value); result.add(rec); rec = new Vector(); value = new Object[] {"Charlie Read", "Craig … | |
[B][COLOR="Red"]guys help me if these code is correct [/COLOR][/B] [CODE=java]import javax.swing.*; import java.awt.event.*; public class SampleCalc extends JFrame implements ActionListener{ JTextField txtNum1 = new JTextField(); JTextField txtNum2 = new JTextField(); JButton btnAdd = new JButton("+"); JButton btnSub = new JButton("-"); JButton btnMul = new JButton("*"); JButton btnDiv = new JButton("/"); … | |
hey everybody! I want to create a program that counts the number of each word in a sentence given by the user. but I dont know how it is. pls help me... | |
Just a heads up, I posted this same question on Dream in code over 2 hours ago and nobody has answered. The link is [URL="http://www.dreamincode.net/forums/topic/197275-checking-for-multiple-keys-pressed/page__p__1153044__fromsearch__1&#entry1153044"]http://www.dreamincode.net/forums/topic/197275-checking-for-multiple-keys-pressed/page__p__1153044__fromsearch__1&#entry1153044[/URL] I have been trying to figure out how to increment or decrement a value if two keys are pressed at the same time (ctrl+, ctrl-). … | |
Hello! I would like to be able to change the sequence of rows in the JTable by clicking on arrows, which will be placed on the right side of the JTable. Please, see an attached file to understand the idea. Well, could someone please give me some advices on how … | |
Hi guys first off i want to say i really enjoy this forum i just signed up but i have referenced it before. so i have a question i need help with. here is the task at hand [QUOTE]A file called [URL="http://www.cs.oswego.edu/~odendahl/coursework/csc212/201009/assignments/03/tables.txt"]tables.txt[/URL] contains ranges that describe multiplication tables. Each line … | |
I want into values into databas using java code...so send me the sample codes on that senarios using javacode i want to insert values into database ...give an idea to impletement | |
hey U guys.. I need a jsp code which uses AJAX with dropdowns.. Something like COUNTRY NAME in one dropdown and STATE NAME in the other... You may select any STATE at first.. Later when we CHANGE the COUNTRY NAME, states of that particular COUNTRY WILL GET REFRESHED IN THE … | |
Hello, I a student and Java is very new to me. I am trying to multiply 2 numbers together to be displayed in a dialog box but I keep getting the error of "cannot find sysmbol" and I do not know what I am missing in my file to clear … | |
Hi! I have a question regarding the SQL Select and "try...catch". The problem is that my SQL Select statement could sometimes return empty sets. For this reason I'm using "try...catch" statement. However, it doesn't work - the error message is generated for the empty set. So, how could I solve … | |
hi i am creating an applet where you click on the button and it adds an image and text to a list, which then will be displayed in a JOptionPane but the Image will not display but the text does. code is as followed; Add the items [code] String additem … | |
hey guys, my code requires a toString method and an equals method. My question is, did i do them correctly? im a bit confused on this topic, Any help, im greatful for, and the toString and equals methods are at the bottom, Thank you so much. [CODE]import java.util.*; class Scores … |
The End.