171 Posted Topics
Re: Yes. It is quite possible. In fact, it's been done several times. See: [url]http://en.wikipedia.org/wiki/JavaOS[/url] As a practical matter, it can't be 100% Java. There needs to be some kind of bootstrap or microkernel for the lowest level stuff to build upon. But one can make an operating system that is … | |
Re: GUI skills will get you a job now. The industry is heading quickly towards a major concurrency problem -- lots of cores vs mostly single-threaded code. If someone can find good answers to that problem, they could be very successful! ;-> | |
Re: [QUOTE=rotten69;1619165]OK. I have awesomely solved this problem. The answers to both sub-questions are ZERO.[/QUOTE] Congrats! You have done your homework. It thinking like that the could just lead to... Math on two's complement representations of numbers. >;-> | |
Re: You have compile errors in your 'addStudent()' method because it's inside the 'main' method. It needs to be between the two closing braces ('}') at the end. Once you fix that, you'll want to change the last two '.nextLine()' calls, as you did in the copy of the code above … | |
Re: @chamnab: What's most important in these problems is to break a big problem down into smaller problems. Starting with that we want to produce this output: [CODE] 1 1 2 3 4 5 1 1 1 1 2 3 4 1 2 1 1 2 1 1 2 3 1 … | |
Re: [LIST] [*]"retrun" is misspelled; it should be "return". [*]"wats" is misspelled; it should be "What's the" or "What is the". [*]"plz" is misspelled; it should be "Please". [/LIST] | |
Re: (Sorry; I posted without seeing the second page. Gosh the code has gained some new problems on the 2nd page. ;-) [LIST] [*]Try entering 'two three space enter'. See what happens. [*]You need to know exactly what [ICODE]tempString.substring(j, j)[/ICODE] is returning. This is a trick that I use: [ICODE]System.out.println(tempString.substring(j, j) … | |
Re: [LIST=1] [*]Use the same code tag to end the code section as you used to start it. (That is, use CODE at the end, not ICODE.) [*]Your main method, as given, does [B]not[/B] cause a stack underflow condition. Do you know how to make a stack underflow occur? [*]I think … | |
Re: Try this: [CODE]public class Hei { public static void main(String[] args) { int s = 0; for (int i = 0; i < 5; i++) { System.out.println("i = " + i); System.out.println(" s = " + s + " before the assignment statement"); s = 2 * s + i; … | |
Re: Some hints: [LIST] [*]The word "void" is how you say "this method does not return anything." [*]Returning the right thing is actually very easy. You're almost there. [*]The trick will be that every path through the method will need to either return something or throw an exception. Using "return null;" … | |
Re: See [url]http://en.wikipedia.org/wiki/Recycle_Bin_(Windows)#Physical_storage_locations[/url] | |
Re: Correct: It's an operating system issue, not a language issue. And pretty much all operating systems work this way. And C/C++ won't be any faster at doing this than Java. Really, If you intend to do that a lot, inserting of characters/lines "in the middle of" text files quite often, … | |
Re: And it helps to know that Bayanihan Linux is based on the Debian distribution, which is popular and well supported. So everything in the general Linux list above should work. This means... [I]you have [B]a lot[/B] of options![/I] | |
Re: This line [CODE]Puzzle[][] puzzle = new Puzzle[4][4];[/CODE] means that each cell in the 4x4 grid is a "Puzzle". So you have 16 "Puzzle" instances. This may not be what you want. You want to have a 4x4 grid of something. What is the thing you want for each cell in … | |
Re: [I]A number of posts to this forum contain code samples that are, unfortunately, over 250 lines. :([/I] For something small that is used in high performance production applications, I'd suggest "WAX", a Java "Writing API for XML." [url]https://code.google.com/p/waxy/source/browse/[/url] Click on directories to navigate: trunk, trunk, java, src, com, ociweb, xml … | |
Re: I could do it without an array. Can you? :-/ javaAddict is correct that there are issues with the formula in the computeBMI method. Get the rest of it working, and then the issues will be apparent. | |
Re: Suppose you created an instance of the class Human, and gave them a name: [CODE] Human h = new Human(); h.name = "Adam"; System.out.println("Hi! My name is " + h.getName());[/CODE] If you then called one of the "change name" methods in your example, how could you see this person's name? | |
Re: If you had the binary number '11100000', could you work out its decimal value yourself, with a pencil and a pad of paper? If you program a computer to do something similar, you will get a value stored in an 'int' variable, which you can print. (And it will, by … | |
Re: You'll probably want to split the string based on the directory separator character ("/"). If it starts with "/" then you'll want to start with the root directory ("/"); otherwise start with the current directory ("."). Look at the "listFiles" methods on the java.io.File class. The one that accepts a … | |
Re: Interfaces and classes must be [B]outside[/B] of method bodies. [CODE]public class CarsDescription { /** * @param args the command line arguments */ public static void main(String[] args) { } interface Domestic {} interface Import {} interface Japanese extends Import {} interface German extends Import {} interface Detroit extends Domestic {} … | |
Re: Yes: It is important to [B]always[/B] compare strings using the '.equals' method -- not the '==' operator. [I](And in Java, the convention is to start method names with a lower case letter. ;-)[/I] There is something to be said for doing the string comparisons like this: [CODE] public static void … | |
Re: People will hate me for saying this, but I recommend starting in Microsoft Windows because it's so commonly used. Personally, I know and like Unix/Linux, but I have to admit that the learning curve is steeper for that than Windows. Also, like it or not, Microsoft is doing the best … | |
Re: Well actually, the "WEB-INF" means "don't let end users browse to this folder and download any files from it." As for "data services," I might suggest... [LIST] [*]SOAP libraries [*]"Web Services" [*]possibly "restful web services" [*]possibly JSON format data (instead of SOAP) [/LIST] There are a great many things that … | |
Re: See [url]http://download.oracle.com/javase/6/docs/api/java/lang/String.html#substring(int, int)[/url] The '.length()' method will also prove useful. | |
Re: I suspect that a more appropriate approach would be to create a single variable that is an 'ArrayList<String>' before the loop, and then call '.add(String)' in the loop. | |
Re: Here's my contribution: [CODE]49274878437,2983874698273[/CODE] Glad to have helped! | |
Re: It's a pragmatic issue, really: You can't do much with a pointer unless you know something about the structure of what it points to. And if you get it wrong, you typically corrupt your data and you can very easily crash the program. PASCAL allows you to overlay pointers using … | |
Re: [LIST=1] [*]If root is null, is the tree symmetrical? [*]If the root node exists, but it has no children, is it symetrical? [*]If the root node exists, and it has a left child but no right child, is it symmetrical? [*][I](The rest left as an excercise for the student. :-/)[/I] … | |
Re: Your [ICODE]for (;;)[/ICODE] statement is just fine. It works just like [ICODE]while (true)[/ICODE]. To answer your original question: You get so many prompts because 'System.in' does not and cannot give you character-by-character input. It can only read a line at a time. It's getting input a line at a time, … | |
Re: Generally the way multi-user Internet games work is that each client connects to the server(s) on port 80 with the HTTP protocol. This is the only reliable way to get through firewalls from arbitrary clients. In particular, in general you cannot connect to clients: Servers cannot open connections to clients. … | |
Re: Ohhh... [LIST=1] [*]It seemed like a good idea at the time. [*]You got a problem with that?!? [*]Really, it can interpret or compile the byte code, depending on its mood. [*]Generally, these days, the JIT (Just-In-Time) compiler does compile the byte code to machine language. [/LIST] | |
Re: That's a really nice homework assignment. You need to design and implement it, as you have done with the GUI. If you have any specific questions or issues regarding the code [U]once you have designed and implemented it[/U], we'd be glad to help. | |
Re: Companies that integrate with ERP systems can afford to hire expensive experienced consultants. :twisted: | |
Re: Also consider...[CODE]System.out.println(System.getenv("Path"));[/CODE] | |
Re: (I took some context from the thread at [url]http://www.daniweb.com/software-development/java/threads/377186[/url] ) What makes you think that it is not working? | |
Re: You might be over-thinking this. Relax. Take it a step at a time. To answer your question... If you have an ArrayList containing "mars snickers", "mars M&Ms" and "mars caramel" then you might want to loop through the elements of the list and print each one. Note that "item #1" … | |
Re: Note: If saving money is the objective, then leave the computer on all the time. Modern computers automatically go into "power saving" modes when unused. But powering them on and off over time causes thermal stress, causing them to fail. So you save money by leaving them on all the … | |
Re: Hint: "One of these things is not like the others. One of these things does not belong. ..." :P [CODE] public void readArguments( readArray) { ... public int countArguments( String args[] ) { ... public static void main( String[] args ) { ...[/CODE] [I](...or really, one of them could be … | |
Re: Provide some way to make multi-threaded programming brain-dead easy and safe for business programming on the JVM. Scala wouldn't be a bad choice for language. Heck, if you really pulled it off, [B]you[/B] could be the next big thing in the industry. You'd have just solved one of the biggest … | |
Re: [QUOTE=Amr87;1622586]3- what distinguish a web developer from another rather than having wide set of programming languages?[/QUOTE] Short term, the particular tools and libraries you know make more of a difference. But you can't build a career out of that. The tools, libraries and technologies people are using change dramatically over … | |
Re: Am I correct in assuming that the regular expression like pattern "A+B*C" means "one or more strings each containing the letter 'A', followed by zero or more strings each containing the letter 'B', followed by one string containing the letter 'C'."? So "AC" would match '[1] ACD, [2] BC'. And … | |
Re: Consider... [url]http://witsign.com/en/index_files/andrmate.htm[/url] | |
Re: Following NormR1's link, here's the official list: [url]http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.9[/url] Now going through this list and figuring out the usage of each of them can be a very interesting and educational exercise for the student. ;-> | |
Re: If you want to create something like DNS, then it may be helpful to know how DNS works. See... [url]http://en.wikipedia.org/wiki/Domain_Name_System[/url] | |
Re: Keeping a sorted list/tree of k values would be O(n log k), I think. If someone asserts that k is a constant, making this O(n), then I'll assert that for any given run, n is a constant, so it's really O(1). ;-> | |
Re: It's possible to be inspired by the way Java solves the problem in HashMap. They create a class: [url]http://download.oracle.com/javase/6/docs/api/java/util/Map.Entry.html[/url] | |
Re: If this code runs on a Unix box, it occurs to me that one of the directories or the file itself might not be readable by the "user" the process is executing as. Try giving everyone read access to the directories and file. On the other hand, you did mention … | |
Re: This is homework. You should write the code. You'll learn better that way. A hint to help you get started: Consider the relationship between [icode]int power[/icode] and the LinkedList index. Doing this might inspire a really good idea. | |
Re: I most highly recommend... [B]Write the whole thing in Jython.[/B] [I](Jython is the version of Python that runs on the Java Virtual Machine (JVM))[/I] If you are successful enough to have performance problems, then... [LIST=1] [*]Optimize the Jython/Python code. [*]Consider upgrading to Java 7. [*]Convert only a few key performance … | |
Re: The "tie" logic is buggy. Play several games in a row; you'll see. [I](I know what's causing this bug, but I'll let you debug it as an exercise for the student. ;-)[/I] |
The End.