This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Rod Taylor

Greenhorn
+ Follow
since Aug 03, 2012
Rod likes ...
Netbeans IDE Java Ubuntu
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
15
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rod Taylor

Thanks all for the time and answers! I marked this as resolved.
2 years ago
Hi All,

On my code below, I want to add a method to an anonymous class. But for some reason, grassHopper.doSomethingElse(); is marked as an error:  "cannot resolve doSomethingElse()". Can someone please explain to me why? Thank you.

2 years ago

Winston Gutkowski wrote:

Rod Taylor wrote:Now, any suggestions where I can find good tutorial points?


Yup. The horse's mouth.

Free and video tutorials preferably.


That might be a bit more difficult; although I hear that Coursera is supposed to be quite good. You may have to do a bit of hunting for the right course for you, and also wait for the next one to start though.



Thank you for the suggestions. Much appreciated!
5 years ago
Hi,

I feel like I need to crank up my Java programming skill. Where I am now is that I know more or less Java syntax but since I'm only doing it, at the moment, as my hobby, I'm not really doing it everyday. Therefore I feel that my skill is still a bit patchy and unorganized! However I would like, eventually, to be a full Java programmer one day (with the slightest hope that I won't be too old for that!!). I would also like to get the Oracle certificate as Java Programmer. That is my ultimate goal. Now, any suggestions where I can find good tutorial points? Free and video tutorials preferably. I heard that Lynda.com is good but I'm on a tight budget now. Thanks for any inputs!

Kind regards,
5 years ago

Tim Cooke wrote:FileReader is a subclass of InputStreamReader which is a subclass of Reader.



I see now that it doesn't need to be a direct subclass, i.e. a FileReader "is" a Reader by indirect inheritance.


Matthew Brown wrote:Click on one of the FileReader links in these posts, and at the top of the Javadoc page you can see the complete inheritance hierarchy.



Somehow I missed this!?? Thanks!
5 years ago
Hi,

I encountered this line of code:



Now, my question is: how is it possible that it's using FileReader class as an argument to the constructor? According to Java 7 API, the constructor for BufferedReader class is BufferedReader(Reader in), i.e. my understanding is that it should have an object of type Reader or Reader's subclasses, and FileReader is not even a subclass of Reader. How is this possible?

Thank you.
5 years ago

Campbell Ritchie wrote:Do you mean copying the whole file? Look through the Java Tutorials; there is a section there about file copying. I haven't read it. I suspect it won't use the Apache class, however.



I tried the Java Tutorials, but it only copies the link, not the target. Then I found FileUtils from Apache, but I'm still stuck with this.
5 years ago
Hello all,

Does anyone know how to copy the target of a link? I am using Apache's FileUtils class. I have tried the following and it only copies the link, not the target:



Can anyone help me on this please? Thank you.
5 years ago
Thank you for all who have contributed to this post!! Very much appreciated.
5 years ago
What class does method Planet.values() in the code below belong to? I thought it belongs to java.lang.Enum but when I could not see it in Java API 7.


Thank you for your help.
5 years ago

Mansukhdeep Thind wrote: Study in detail the following-

a) -classpath flag option of javac command

b) significance of package statement in relation to javac command

c) how the compiler searches for classes i.e. what all paths / directories will it look in. You do have the compiled Car.class file. But the compiler is unable to locate it. Find out the reason why.

You find answers to all these questions, you find the answer to your posted query.



Many thanks for your reply. I finally figured it out. It was all because the compiler cannot locate the .class file. By providing the -cp on the javac command (in conjuntion with -d option), it overrides the CLASSPATH environment variable, or the current directory if it's not set.
7 years ago

Mansukhdeep Thind wrote:


Now to get back to your question. What is the command that you are giving to the java compiler when asking it to compile MyCar.java. Tell me the exact command.




First off, thank you very much for your corrections. You really made a point with clarity of the code.

Second, the command I use is to compile MyCar.java and to compile MainApp.java. I use this command (-d) because I want to put the .class files and .java files in two separate folders.

Campbell Ritchie wrote:
And please show us the directory structure. Which is your current directory?



C:\javacodes have 2 folders, namely class and source. I want to put all the .java files in source folder and the class files in class folder. At the moment, I have all the MyCar.java, Car.java and MainApp.java in source folder.My current directory, where I'm trying to compile all the java files from, is C:\javacodes\source directory on the command prompt. But I can only seem to be able to compile Car.java. I can't compile the other two files from the same location. It keeps giving out error of "Cannot find symbol" on both the other classes.
7 years ago
Hi,

I am having a problem in compiling java files that implements an interface. I also want to put the source files (.java extension) and the class files (.class extension) on different folders.

I keep getting error "cannot find symbol" on MyCar.java everytime i try compiling it. Here is my source code:

Car.java:

package interfacePractice;

public interface Car {
//constants definitions
int minimumSize = 25;

//method signatures
int turn (double radius, double speed);
int signalTurn(boolean signalOn);
//String printMe;
}

MyCar.java:

package interfacePractice;

public class MyCar implements Car {
int Turn(double radius, double speed) {
// Definition of method Turn
}

int SignalTurn(boolean signalOn) {
// Definition of method SignalTurn
}

public MyCar() {
System.out.println("An object of MyCar has been created. The min size is: " + minimumSize);
}

public String printMe() {
return "I am a VW";
}
}

MainApp.java:

package interfacePractice;

public class MainApp {
public static void main(String[] args) {
MyCar aCar = new MyCar();
System.out.println(rodCar.printMe);
}
}

I use the command: javac -d C:\java\class MyCar.java when I try to compile MyCar.java. It went ok with Car.java but not with MyCar.java. Can anyone help please? Thank you.
7 years ago

Winston Gutkowski wrote:
I have no doubt that you could program an abstraction of a PLC in Java

Winston



Can you please tell me what you mean by programming an abstraction in Java by this?
7 years ago

Campbell Ritchie wrote:What is PLC? In Britain it means public limited company, so I thought it meant some sort of programming as used in large companies, like Siemens, Allen-Bradley, or Mitsubishi. I was obviously mistaken



Yes, it's Programmable Logic Controller.
7 years ago