4,084 Posted Topics
Re: @BeefRocks: seriously ... I would assume that the previous post stating that this was an ancient thread which wasn't in need of reviving was clear enough. I do assume you noticed this, and, while doing so, you also noticed that thát particular post is over a year old, right? | |
Re: let me guess... stackoverflow? each A instance has an A Object as instance variable that instance variable in turn is, an instance of A, so, see previous line. you're basically creating an endless number of instances of A, and yah ... that's about to go wrong. | |
Re: you could also have tried 'ye olde Google', or provided us at least with some code and a specific question. take a look at [URL="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html"]this[/URL], might be of some help. | |
Re: @Zwinky: is this your response to the OP's question, or is it a new question? in both cases, you shouldn't have posted it here. this thread hasn't been open in several years, so the chance of the OP coming back to read your post is as good as nill. if … | |
Re: .exe code? you declare a variable as private to increase encapsulation. also, this makes sure you control how other classes can access the value of the variable. when they're marked private, the value of the variable can only be changed or gotten through the use of methods (setters and getters). … | |
Re: what exactly do you mean by this? public class SchoolGroup { // Protected variables with type intger " protected b-coz i may need to inhert this classs " if you extend a class, you can still use it's variables and methods, the difference is the way you can access them. | |
Re: and if not, make for yourself a list of when each element will be printed. check the locations of the break statements and, this is propably the issue they want you to figure out, explain the consequences of the break statements, those who are there, and those that were omitted. | |
Re: [QUOTE=stevanity;1578389]Is that necessary? As far as I know, its optional to include parameters to receive command line arguments. Correct me if Im wrong.[/QUOTE] indeed it is, but you need to provide the possibility to pass on parameters. you should consider the main method a method that should only be able … | |
Re: @decade ... and how will Arrays.sort(fish); work? how is it going to compare the elements to see in which order they should be ordered? @htmler I would recommend you to check on tekashyap's answer and the links he provided. if you want to use Arrays.sort(fish), as decade suggested, you will … | |
Re: there is one possible sollution: stop being a cheap ass and pay for 'unlimited INTERNET' not really java related, though | |
Re: @shedai the sleep method is static, so you don't need to have one running (well, for the purists among us, I mean other than the main-thread) to call the sleep method. all that really had to be said, as an answer to the OP's question, has been said by JamesCherril … | |
Re: in your first code, you could also make the call method static. this way, you could call it from within your main method without having to instantiate an object | |
Re: which propably works better with : [code=Java] public char pop(){ ListNode node = null; .. } [/code] :) | |
Re: [QUOTE=Zurompeta;739637]Hi, Basically, I'm trying to parse a string into a char for submitting into an array, this is what I have so far: [CODE]String strVariable; Char charVariable; strVariable = "Some String"; charVariable = String.ParseString(strVariable);[/CODE] The bottom lines yields an error...is this possible to do?[/QUOTE] no first of all, it's no … | |
Re: by putting your project into a (valid) .jar file. you can do this by using the functionality of your IDE, but you don't need an IDE to create one. winrar (or a similar program) will do just fine. | |
Re: none the less, his other point makes a lot of sense. whether or not java is object oriented, depends on how you write your code. it is meant to be (and no, I'm not going into the whole primitives-aren't-objects debate, since obviously, they aren't) but if you ignore OO alltogether … | |
Re: to reverse this, you'll need at least three values: 1. the value of the original divider (2) 2. the value of the result of the original division (3, since 6/2 = 3) 3. the value of the remainder (0, since 6/2 does not leave a remainder) you multiply the original … | |
Re: unless you decide to add a constructor to A, which does take parameters, then you'll need to add the call to super in the constructor of B, with a parameter. if you don't, the (automatically) ran super(); will try to find the public A(), won't find it, and bleep ... … | |
Re: you get value 10 since, as Thijk posted, the expression count < 10 will only return false when count = 10 (or count > 10). the next increment is a postfix, so count will only be incremented after the value of b is set, so when you're printing your line: … | |
![]() | Re: well ... a bit far fetched and propably not the most efficiënt way: if you have a class ClassObject, add a static collection in which you put all the ClassObjects you create. might be a bit like: [Code=Java] ClassObject.addToList(new ClassObject()); ... ArrayList createdItems = ClassObject.getList(); [/Code] with addToList and getList … ![]() |
Re: maybe you've seen code snippets in which it works. the constructor without any arguments, is the default constructor. If you don't declare any constructors at all, the compiler will 'create' the default constructor for you, since you'll need to have a way to instantiate the class. in the code above, … | |
Re: when you first run your application, you write a properties folder containing the current date, which equals the date of the first day the application ran. next times you run it, you compare the system date with the date which is stored into the file. off course, you could also … | |
Re: well ... you'll need to learn a bit more than just the standard 'increment a primitive value' java functionality. just google java + sound and see what you find. java can (by itself) play sounds like wav, but if you want it to play .mp3 files, you'll need some extra … | |
Re: well ... I've just looked fast over it, haven't got much time at this moment, but for starters: Account is not supposed to extend Bank, Bank is supposed to 'have' 0...n Accounts a bit like this: [code=java] public class Bank{ // Create an array of Accounts private Account[] accounts; public … | |
Re: well ... you're not showing all your code, so I can just guess as to what you mean. you are instantiating a new Dice object (myDice) but you never use it. just call the methods defined in the Dice class by using the myDice instance. | |
Re: @cretaros: you might want to check the difference between an IDE (integrated development environment) and a compiler. since we still have no response to wether or not we're talking about an actual application or applet here, could you please post the code you're trying to run here, and any error … | |
Re: or, you could make it a lot easier: you set a instantiate a String Object with value ""; iterate from 1 to n, doing: theString = n + oldStringValue; printLine(theString) this won't use an array, if that's in your task description, but it'll do what you need. you could apply … | |
Re: or just a quick scan of the code ... you try to use variables, but you don't use the names that you initialized them with. since you never declared a variable with the name Record, it should be quite clear why you can not use it. | |
Re: now, actually, that's not as much a problem. there are several ways you can do this. the first is to use + - * / = as separators, and use the indexOf and substring method of string objects to get the numerical values. an other way is to, char by … | |
Re: by writing formatted string objects (with predefined length or separators) to a flat file (like a .txt) | |
Re: @keval hack: you're kidding, right? the OP didn't even ask a question in his post, so why guessing what the question might have been and providing an answer that might very well be an answer to a wrong question? next to that, you may (or may not) have noticed that … | |
Re: what do you mean? how you program 'a game' in java? I assume by writing the code. if you want a better answer to your question, I recommend you to be a little more specific in your question. Also, when you expect custom made code, I'll tell you now that … | |
Re: I'm not going to read through all of that, since 1. you're not the original poster of this thread, which means you're likely someone handing out a quick sollution that you think fit the needs (actually hope in this case I'm wrong) 2. you didn't put your code between code … | |
Re: [URL="http://tinyurl.com/3c4pbjx"]This[/URL] might get you started. It would even seem like a logical place to start a search like this. | |
Re: I would start with SE, and if you're really just starting with Java, I would recommend starting without an IDE like NetBeans or Eclipse, untill you are more familiar with the java syntax yourself. NotePad++ will do just fine to write your code in, and you can let the code … | |
Re: and what exactly are you stuck with? I'm just checking this from work during my lunch, which means I don't have the time to copy-paste-compile-run-debug the entire story. what do you get? what did you expect to get? what error messages or exceptions do you get? if we know that, … | |
Re: you may want to be a bit more specific, looks a bit like you just copy-pasted your assignment here. I don't see anything wrong with that print, btw, except that it's missing some spaces for formatting and that that information (weight ... ) should be stored in the class Person, … | |
Re: by .... writing and running the code? what have you got so far? are you going to reuse the application you had earlier, or start completely overnew? | |
Re: after if and before else? you mean like this? [code=java] if ( valid ){ // code if valid } break; else{ // code if not valid } [/Code] looks to me like you're setting yourself up to get two problems.. 1. you'll run the break no mather whether valid is … | |
Re: well ... you just read the nr of lines into an int, without reading the objects to store, and use that int as the size of the array. this would make what you want possible, if you use the other way to create an array. for instance: [code=java] int nrOfElements … | |
Re: ehm ... what is not working about it? OK, you know which methods to call, but how are you calling them? looks to me like you'll need either an infinite loop that turns the led on and off [Code=Java] while ( true ){ dev.getPortD().setPinValue(0, true); dev.getPortD().setPinValue(0, false); } [/Code] off … | |
Re: are you actually asking us how to bypass or crack the security on credit cards? | |
Re: @MingMing 1. if it's part of your thesis, you might want to put some effort in it yourself. we are here to help and guide you when and if we can, not to do your (school)work entirely for you. 2. if you realy need code like it's been asked for … | |
Re: Joooria... have you even tried to read the answers the previous posters have given??? don't hijack threads, start new ones next to that ... have you tried anything yet, or are you just expecting us to write it for you? write the code, see if it works or not, if … | |
Re: there are loads of IDE's (Integrated Development Environment) out there, but if you are, what I assume is the case, are new to java developing, I would recommend either notepad or notepad++ if you're using windows, or trying vi in case you work in linux. | |
Re: use a for loop to iterate over the first row. then, for each array you encounter, compare the first element to a value. while doing so, keep a value in memory which is set to 0 before the loop, and which increases by 1 every iteration where you encounter the … | |
| |
Re: @Casinoua: don't just hand out custom made code, certainly not if it contains logical errors. the OP doesn't want to sort on the names, just on the codes. if you sort like you do, your names will be placed next to the wrong name. | |
Re: you already have several arrays in your application: ids, hours and rate. so you can see how you create an array. now, you don't have, from the start, all the values at once to put in the array, but you do know how many elements your array must have, since … | |
Re: have you written anything yet? show us what you've got so far, don't wait until we write it for you |
The End.