1,963 Posted Topics

Member Avatar for javaAddict

Hi everybody. I have a problem and I need some suggestions. A few weeks ago, my monitor suddenly turned off on its own. Then I shut down my computer and switched it on again, and after 5 minutes the monitor turned off again. This happened several times in a row. …

Member Avatar for Suspishio
0
145
Member Avatar for keicola

For reading lined from a file: [CODE] try{ BufferedReader loadPlayerPositions = new BufferedReader(new FileReader("/media/KEI-SAMA/CS11/JOKE CS11/KnowGoMilestone5/playerpositions.txt")); String line = loadPlayerPositions.readLine(); while ([B]line!=null[/B]) { System.out.println("Line read: "+line); [B]line = loadPlayerPositions.readLine();[/B] } } catch (Exception e) { System.out.println("Exception: "+e.getMessage()); } [/CODE] With that way you read each line. Do some checking in case …

Member Avatar for keicola
0
241
Member Avatar for emilio
Member Avatar for nope3d

I have been reading your thread for some time now, searched the google, asked my colleagues, called some of my old professors but still no one can answer this important question: [QUOTE=nope3d;1002366] ...Can anybody knows how can I put a table on what type of Package type (overnight and two …

Member Avatar for javaAddict
0
133
Member Avatar for Hockeyfreak889

Here is an example with arrays: [CODE] Empleoyee emp = new Empleoyee(); // this is an [B]Empleoyee[/B] Empleoyee [] empArray = new Empleoyee[10]; // this an array // emp is an Empleoyee // empArray is an array // the empArray above is not null //empArray[0], empArray[1], empArray[2], ... are [B]Empleoyee[/B] …

Member Avatar for javaAddict
0
87
Member Avatar for keekee

Can you post the whole stack trace? [QUOTE] java.lang.NullPointerException [/QUOTE] It means that you are trying to use something that is null. At the stack trace you will find somewhere one of your classes mentioned. Go to that line and there something is null

Member Avatar for javaAddict
0
115
Member Avatar for WesFox13

Don't write this: [CODE] return (((multi * seed) + incr) % modu); [/CODE] When you calculate the result store it into a variable. Then change the value of the seed with that variable and [U]then[/U] return it.

Member Avatar for WesFox13
0
186
Member Avatar for keekee

When you write this: [CODE] public void setName(String name) { name = name; } [/CODE] Both "name" in [ICODE]name = name;[/ICODE] refer to the argument. So you are just changing the value of the argument and you are putting the value of the argument back at the argument. If you …

Member Avatar for keekee
0
289
Member Avatar for .11

Check the class javax.swing.ImageIcon with constructor: [ICODE]ImageIcon(String filename) [/ICODE] Then you can use a JLabel with constructor: [ICODE]JLabel(Icon image)[/ICODE] You might want to consult the above classes' API

Member Avatar for .11
0
130
Member Avatar for opethcire316

[CODE] String input = in.next(); if (input.equalsIgnoreCase("Q")) done = true; [/CODE] when you get the input you can do: [CODE] String input = in.next(); // will return the first character // also check the length of input (if input has length 0 you will get an error) char inp = …

Member Avatar for opethcire316
0
3K
Member Avatar for rainny

Without seeing code the only possible and logical way is when you click the button to set the variable that you display as the time back to zero

Member Avatar for emint
0
78
Member Avatar for moyphus

(((10000*5000)-2000*3000)*30/100) / * - * 10000 5000 * 2000 3000 30 100 Is this what you want?

Member Avatar for moyphus
0
75
Member Avatar for r1990

First of all this is a question for the JSP forum. Secondly what do you mean when you say "heading". Explain better with some code. Also you can submit the page and when you go at the the next page you can do this: [CODE] <% String uni = request.getParameter("uni"); …

Member Avatar for javaAddict
0
150
Member Avatar for ash2401

Check the [B]Read Me[/B] post at the top of the jsp forum: [U]JSP database connectivity according to Model View Controller (MVC) Model 2[/U]

Member Avatar for emnidhi
0
103
Member Avatar for Anjana sharma
Member Avatar for peter_budo
0
80
Member Avatar for JimD C++ Newb

Can you see something wrong with this code: [CODE] public void setName(String appt){ [B]setName[/B](appt); } [/CODE] You calling the same method. When you call [I]setName[/I] it will call [I]setName[/I] which is inside it, which will call [I]setName[/I] which is inside it, which will call [I]setName[/I] which is inside it, . …

Member Avatar for javaAddict
0
2K
Member Avatar for kirtichopra

By searching this forum you will find plenty of examples on how to read files. Look for the classes: BufferedReader Scanner

Member Avatar for pooja.ui7
0
205
Member Avatar for engg_kavi

Get the value. Execute the query. Check the API: java.sql. Connection, Statement, ResultSet Ask specific questions about where are you having problem.

Member Avatar for javaAddict
0
112
Member Avatar for priya ravi

[QUOTE=priya ravi;991910]create a program using java for virus can u please help me.[/QUOTE] Does this mean that you want a virus written in java or the opposite? An anti-virus written in java[B]?[/B]

Member Avatar for javaAddict
0
47
Member Avatar for jwdvorak

Try to put more debug messages: [CODE] System.out.println("Checking rs"); if (rs.next()) { System.out.println("rs.next: TRUE"); int rc = rs.getInt("RecordCount"); System.out.println("rc= "+rc); if ( rc> 0) { isMemberAlive = true; } } else { System.out.println("rs.next: FALSE"); } [/CODE]

Member Avatar for javaAddict
0
1K
Member Avatar for endisbegun

Semicolon ( [B];[/B] ) separates commands. When you write this: [CODE] if (v1 < 500); total = ((v1 * .02) + 5); [/CODE] You have ONE if statement, that executes [U]nothing[/U] because of the semicolon. It doesn't matter if it returns true or false. It "terminates" at the '[B];[/B]' Then …

Member Avatar for jasimp
0
282
Member Avatar for AbiSuren
Member Avatar for moyphus
Member Avatar for javaAddict
0
54
Member Avatar for sawant_nitesh

I believe that they are both the same when it comes to the number of Objects created. The difference is the scope of the "MyClass" instance. In the second case you can use the "[I]m[/I]" outside the for-loop. With the first case you cannot. The second case is useful when …

Member Avatar for javaAddict
0
118
Member Avatar for and12

I am sorry for being late to respond to this. [B]Firstly[/B] if you read all of the posts related to that particular question in both threads (the poster created 2 threads), you will reach to the conclusion that the [I]poster[/I] was accusing the programming language because he couldn't get his …

Member Avatar for ~s.o.s~
-2
464
Member Avatar for LKH
Member Avatar for exception
0
47
Member Avatar for amitabhpandey

Is your code working? If not, where are you having problems with? Also I would suggest, next time, to use the javax.swing.* package (JFrame, JButton, ....)

Member Avatar for masijade
0
110
Member Avatar for T'Scoopz

This: [CODE] while (myPhrase != null) { myArrayList.add(newPhrase); /****ERROR here*/ } [/CODE] is an endless loop. [I]myPhrase[/I] is not null, you don't change its value inside the loop so it remains not null. Thus the loop will keep running forever and eventually you will run out of memory. I don't …

Member Avatar for sneaker
0
85
Member Avatar for Abibina

Reading and writing to file using Buffered..... [CODE] BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(file)); writer.write("Line is written to file"); writer.newLine(); } catch (IOException ioe) { System.out.println("Error: "+ioe.getMessage()); } finally { if (writer!=null) writer.close(); } [/CODE] [CODE] BufferedReader reader = null; try { reader = new …

Member Avatar for javaAddict
0
114
Member Avatar for javanub123

You haven't defined the variable: [I]password1[/I] Also you don't need 2 Scanner objects. Use one and call the method [I]nextLine[/I] as many times as you like

Member Avatar for javanub123
0
98
Member Avatar for droeph

[CODE] int Monthname = input.nextInt(); int Monthday = input.nextInt(); switch (Monthname) { case 1: Monthname = "January"; Monthday = "31"; [/CODE] Monthday, Monthname are declared as [B]int[/B], at the beginning of your code. But then you do this: [ICODE]Monthname = "January";[/ICODE] "January" is a String. You cannot put a String …

Member Avatar for javaAddict
0
166
Member Avatar for redsunit
Member Avatar for runee1000

You need to give values to your variables: [CODE] int a; int num2; int num1; [/CODE] I suggest you enter put some values inside the code in order to test if the logic is correct: [CODE] int a = 2; int num2; = 4 int num1 = 10; [/CODE] And …

Member Avatar for akulkarni
0
142
Member Avatar for shahravi88

Read the API for the method: [I]JOptionPane.showInputDialog[/I] If you test your code and see what happens when the user clicks "Cancel" you will see that the method returns [ICODE]null[/ICODE] as the API says. So you need to do some checking of the "firstname","lastname".

Member Avatar for javaAddict
0
116
Member Avatar for kahaj

[QUOTE=hoke;981773] P.S. I agree that java sucks :)[/QUOTE] Why? Because Someone accidentally misplaced this '=' with this '=='. I am not accusing anyone since I have made such mistakes when copying code, but tell me one language that doesn't use this operator: '=' for assignment. [QUOTE=kahaj]I'm finding it to be …

Member Avatar for javaAddict
0
121
Member Avatar for ganesh5155

Read input from user. Write if else statements to check what was given and print the appropriate message. Search this forum for example on reading input with the java.util.Scanner class. Check the API of the java.util.Scanner class

Member Avatar for javaAddict
-1
89
Member Avatar for jrosh

Use the api of the JCheckBox to get the values and then run an insert query to the database. For better answer ask better and more specific question.

Member Avatar for javaAddict
0
49
Member Avatar for osirion666

I don't know if this will solve the problem, but at this line: [CODE] out.println("<input name='Delete' type='image' src ='images/del.png'value=" + id + " alt='Delete' onclick='javascript<b></b>:return deltest();'/> "); [/CODE] You need a space between the value: [QUOTE] 'images/del.pn[COLOR="Red"][B]g'v[/B][/COLOR]alue [/QUOTE] And here you need to add the single quotes: [QUOTE] out.println("<input name='Delete' …

Member Avatar for osirion666
0
90
Member Avatar for nicolek808

If you check the API, the [ICODE]scan.nextInt()[/ICODE] returns an int value, so it doesn't have a [ICODE]toString()[/ICODE] method. Objects have that method. "int", or "float" and the others are not Objects. Try this: [CODE] myArray[i] = String.valueOf( scan.nextInt() ); [/CODE]

Member Avatar for quuba
0
162
Member Avatar for Dajer

[QUOTE=Dajer;978647]Hi friends what's a role of index in RMS? when we use index in RMS? plz I need your help.[/QUOTE] What is RMS then?

Member Avatar for javaAddict
0
68
Member Avatar for low1988

Your second post is the wrong way to do things. Your first was correct, but you didn't understand the advice given to you. [CODE] for(int i =0;i<ar.size();i++) { Employee emp = ar.get(i); System.out.println(emp.getPosition() + emp.getDepartment() + emp.getName() + emp.getidNumber()); } [/CODE] When you do this: [CODE] for(int i =0;i<ar.size();i++) { …

Member Avatar for javaAddict
0
154
Member Avatar for push

Your post is rather confusing. If I get it right: You will have a list of <select> tags and checkbox tags. Each "select" will be connected with each "checkbox". When the user submits you will have to get the value of ONE "select" box and that select box would be …

Member Avatar for javaAddict
0
475
Member Avatar for JavaGalaxy.com

I would have suggested for the user to give the date format as well. Or perhaps a try-catch with a throw inside the catch in case the user didn't enter a valid date.

Member Avatar for frodo_cute21
0
1K
Member Avatar for Alpdog14

[QUOTE=akulkarni;966404]check this out [code=JAVA] class searche { public static void main(String args[]) { String s1="tangerine"; int d=s1.length(); int result=0; for(int i=0;i<d;i++) { if(s1.charAt(i)=='e') { result=1; System.out.println("position of e is at "+i); } else result=-1; } System.out.println("result= "+result); } } [/code][/QUOTE] I haven't read the entire thread, but I don't agree …

Member Avatar for javaAddict
0
165
Member Avatar for dasatti

[QUOTE=dasatti;966809]I searched for it on google but no success. Thanks[/QUOTE] Well if it is not on google you will have to write it yourself. If you have any trouble, post your code and you will get help.

Member Avatar for dasatti
0
3K
Member Avatar for and12

The only bug I see is you accusing a programming language which has been around for decades, used by thousands, for your incompetence. Just because you can't get it to work doesn't mean it has a bug, it means you don't know what you are doing. It is OK not …

Member Avatar for sneaker
0
274
Member Avatar for and12

[QUOTE=and12;966514]To say that I am not offended at being called "incompetent" in what i thought was supposed to be a friendly forum would be lying. [B]I stated long ago that i was NEWBIE to java. [/B] All i meant by my original post was why not MAJORITY of people can …

Member Avatar for javaAddict
0
178
Member Avatar for coud_ren_26

Run this: [CODE] int N = 4; int M = 3; for (int i=0;i<N;i++) { System.out.print[COLOR="Green"]ln[/COLOR]("I= "+i); for (int j=0;j<M;j++) { System.out.[B]print[/B]("J="+j+" "); } // end inside loop System.out.print[COLOR="Green"]ln[/COLOR](); } // end outside loop [/CODE]

Member Avatar for akulkarni
0
166
Member Avatar for gauravagg2
Member Avatar for harsh2327
0
91
Member Avatar for llemes4011

A library for formatting dates. Every time I do that I have to create a new SimpleDateFormat, declare the format and use its methods. Have a class that does that. Also you can have a validation method that takes as argument a String and a format and checking if the …

Member Avatar for javaAddict
0
98

The End.