- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
58 Posted Topics
Re: You should havesomething like: if ( number % 2 == 0 ){ // The number is EVEN } else // the number is ODD } number % 2 - will result in 0 if the number is divisable (has no remainder) by 2 Modulas operations return any remainder of the … | |
Re: AS Narue says, use get/set judiciously. The greatest power of Java (and any OO programming language that is,) is the ability to 'encapsulate' data (members) to better control how to use that data. A good example in your above code is if you wish to make the course member 'read-only' … | |
Re: Class variables (members) automatically initilize to a default value. Method variables do not. You did not set a value for 'number' when decalred in your 'main' method. Even though you do set it in the 'for' loop, the compiler assumes that you could possibly never enter the loop. Since this … | |
Re: Here is a document you might also want to read: [url]http://www.javaworld.com/javaworld/jw-04-1996/jw-04-synch.html[/url] | |
Re: See: [url]http://www.javaworld.com/javaworld/jw-10-1998/jw-10-toolbox-p2.html[/url] | |
Re: Look at the String documentation at: [url]http://java.sun.com/j2se/1.4.2/docs/api/index.html[/url] specifically at the substring method | |
Re: Is this for a mobile device? The library you downloaded is: [b] Micro Edition[/b] Mobile Media API Reference Implementation Version 1.0 (MMAPI) You may be experiancing problems because you are trying to run the app as a PC app, and the library is not designed for the PC environment. Hence … | |
Re: Two things. One, show us first what you have. Then we can assist in helping you Two, this forum is for assistance, not free code. If you want to learn how to do it in Java, show some effort first. I work for a living and do research accordingly. I … | |
Re: You can also look here for some help: [url]http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html?[/url] | |
Re: First glance is you defined a constructor with a parameter. If you define a constructor with a parameter, you also need to define the default constructor. | |
Here is a good tutorial link: [url]http://www.javaworld.com/javaworld/jw-05-2002/jw-0503-java101_p.html[/url] As a matter of fact: [url]http://www.javaworld.com/[/url] Has some excellent articals. | |
Re: Take a stab at it first, then post what you have. It's easy to do the work for you, but then what would you learn from it? If you are interested in code, then check out something like: [url]http://www.planet-source-code.com/[/url] | |
Re: I did a search, and found: [url]http://www.diamondedge.com/[/url] Also [url]http://www.blackdirt.com/[/url] and [url]http://www.vb2java.com/vb2java.html[/url] | |
Re: It also helps to state the problem that you are having. Just saying HELP gives me no clue as to the problem you are having. I can infer somewhat from your statement above, but my determination is you want to know how to read input and place it into the … | |
Re: Hummm.....personal computers; did not exist when I was 14! :lol: | |
Re: Actually in a program (application) you will only have one main method. All others are just classes (with no main method). Same as in VB, you only have one 'Sub Main' routine. | |
Re: In both methods: char crypt char decrypt You specify a char return type, but you are returning an char array type char[] crypt char[] decrypt | |
Re: Actually the above will not work. You need to look at the .equals and the .toUpper, or .toLower methods for a String. This should get you going in the right direction. | |
Re: Please clarify by what you mean by 'what type of poker hand it is'? Are you refering to the type of hand (i.e. Straight, flush, full house, ... ) ? | |
Re: Speeking of language, I think this is a JAVA language too. To all parties, just let vyk2rr, make his post now, in english please and be done with it. Yes, it can be said that we all need to learn about other cultures. Being retired military, I have seen other … | |
Re: It is a matter of scope. Put [code]int number = 1[/code] outside the Main method (at the begining of your class.) Look up the deffinition of scope in Java to learn more | |
Re: You use DOT notation (much like you do in VB I think.) [COLOR=Red]ClassInstanceName[/COLOR].[COLOR=DarkOrange]MethodName(Optional parameters)[/COLOR] So if you have: [CODE] String myString = "Something"; // Then you could say: System.out.println( [COLOR=Red]myString[/COLOR].[COLOR=DarkOrange]toUpper()[/COLOR] ); [/CODE] '.toUpper' is a method of the String class that will output the string in upper case. :cool: | |
Re: I imported your code, and the only errors I received when run is an index out of bounds error, (when I clicked one of the buttons,) but that was because you have no values for; public final String[] PolyIC = {/*stuff*/}; public final String[] PolyIN = {/*stuff*/}; public final String[] … | |
Re: You also need to enclose it in a try/catch block [code] try { int vals[] = new int [12]; vals[18] = 10; } catch (ArrayIndexOutofBoundsException) { //handle error } [/code] Note - since you create the vals[] array in the try/catch block the vals[] array will not be available after … | |
Re: One hint I will give you. Where do you set the value of 'play' after each turn?? | |
Re: Which question? I see 9 questions. Answer the ones you know, and we MAY be able to help with the rest. However, this forum is not for you to submit your homework assignments for us to do. You should at the very least try to answer them yourself first. | |
Re: I assume you are wanting to take the value from 'stdin' and build your query? Then: [code] ResultSet query = stat.executeQuery("SELECT * FROM Grade_Report"); [/code] becomes [code] // First create a String to hold your query at the begining of your code String sqlQuery; // Now either after you read … | |
Re: public Calculator getCalculator() { return calc; } You never declare what 'calc' is. public Calculator getCalculator() { Calculator calc; return calc; } However I would assume that you would assign something to 'calc'? | |
Re: OK, I think I found your problem. Change String getFile = chooser.getName(); to String getFile = chooser.getSelectedFile().getPath(); The reason you received a Null Pointer exception is FileReader filegetter = new FileReader(getFile); returns the name of the file. However getFile only contains the name of the file, not where to get … | |
Re: 1. Open file 2. Read line 3. Save values (Name ;Magnitude) 4. Save Name to save variable (saveName) 5. Create Array 6. Store values in array 7. Begin loop 8. Read file 7. If end of file clean up and close 9. If Name == saveName Store values in array … | |
Re: Just taking a quick stab at it, but: Record c; Record r = c.copy(); should be: Record c = new Record(); Record r = c.copy(); This will initilize c to a new Record instance. | |
Re: You want to set up a loop. Save your initial 'P' value, then feed it back into the equation. Then check the result and determine if it is stable or Extinct. You can put the below in it's own method called 'Malthusian': [code] public int Malthusian { double saveP; double … | |
Re: Did you unZIP the files? There should be a [B]ilookpano.class [/B] in there. | |
Re: Hummm, you want an answer without posting any code? Like fixing your car when you left it at home....... :) | |
Re: In order for use to help you, we need to see your code. As has been stated a number of times, this forum is for helping with Java codeing......not doing your work for you. | |
Re: Not sure what you mean by "Put it alltogether" But in simple terms, each class will go into its own file (with the name of the file the same as the Class name.) So your Student class will be Student.java, Your InsyStudent class will be InsyStudent.java. The only other thing … | |
Re: Try looking at this thread: [url]http://www.daniweb.com/techtalkforums/thread10700.html[/url] It was talking about converting total seconds into H:M:S | |
Re: In your code: ... if ( denomerator % factor == 0) { int newdenomerator = ( denomerator / numerator ); } ... You delcare 'newdenomerator' within your if statement (it is declared between the { and } ). Anything declared between brackets ({,}) has its scope only in the brackets. … | |
Re: Well, for one you have a function: private TextField setEditable(boolean b) { return null; } And you use it in your init method as such: display = setEditable(false);// add(display); SO this tells me that you set TextField 'display' to NULL, then try to add it to your display TextField. I … | |
Re: One thing that I can think of. If you declare a constructor with parameters (and overloaded constructor,) like you did above, you also need to declare the default constructor (with no parameters.) public Salary() { // Default init process } If not then your compiler will complain. | |
Re: Well, every Java Application that is executed (from a command console, or DOS prompt,) should have a 'main' method public void main ( String[] args) { // Your main method } | |
Re: First question is what is your 'EasyReader' class? Can you post the code for it? I suspect the return from "passwordattempt = console.readLine();" is corrupt, but since console is from the 'EasyReader' class I can't tell. | |
Re: Taken from the Java in a Nutshell try { // Normally this code runs from the top of the block to the bottom // without problems. But it can sometimes throw and exception, // either directly or with a throw statement or intdirectly by calling // a method that throws … | |
Re: Try looking here: [url]http://forum.java.sun.com/forum.jsp?forum=48[/url] | |
Re: To solve the problem with not looping to ask for a new input, you need to include the entire Dialog, Switch statements in a Do-while loop too. In essance your main app, only asks for input once, and then processes the switch statment, and then exits the program. | |
Re: A constructor in essance is a method (with the same name as the Class) that is executed when an instance of the class is created. For Example: public class foo { public int x; // Constructor public foo() { // Do something like this.x = 45; } } So when … | |
Re: Where is your Dataset() method defined? Are you including this class on your floppy? I ask because I don't see it (Dataset) defined, or included in your code above. I assume you are compiling on a different PC? | |
Re: As a general rule, Class primitive type variables are automatically initialized to a default value. However if the variable is declared in a method (as in your case,) the value must be initialized prior to use. Even though you set the price to a value, they are all done within … | |
Re: Check for missing semi colens ';' That would be my first attempt at finding the problem. | |
Re: You are creating the array in your main routine: public Assn1() { //initialize data members myCDs = new CD[5]; //provide a dimension for the array ...... By doing this the scope of the array is only visible within the main routine. I think you need to create this as a … |
The End.