Benjamin Bielschowsky

Greenhorn
+ Follow
since Jun 22, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Benjamin Bielschowsky

Hey Guys, I am beginning to learn about reading files on the disk and I see these 3 methods: FileInputStream, DataINputStream, and BufferedReader. Below I posted 2 snippets that do exactly the same thing, the first reads a text file by only using bufferedreader and the second uses all 3 methods. What's the purpose and function of each: FileInputSteam, DataInputStream, and BufferedReader, and why would I use all 3 when it seems that I could do the same thing with only BufferedReader.
Thanks!

Only using BufferedReader


Using FileInputStream, DataINputStream, and BufferedReader
11 years ago
Awesome! I found out I had the plug-in the whole time, it works great. Thanks for the recommendation.
11 years ago
Hi guys, I've been searching around and have been looking for a "Drag-and-Drop" type plug-in for eclipse to create a GUI application. I know you can hard code it and then have to position it with numbers and such but is there a simpler way to do so? I found an IDE called netBeans that does what I want, but I just wanted to get familiar with one IDE before jumping off to another and I think Eclipse is more popular.
11 years ago
Thanks for the tips, this is my first forum I have ever joined, I am very eager to get better and learn how to create cool programs. I will open up new threads to answer my future questions, thanks for the welcome and the tips.
11 years ago
To add on, is there a "Drag-and-drop" plug-in for eclipse that allow developers to easily create GUI interfaces? And another question, does Java have placeholders for printing? I come from C# background and if you wanted to incorporate multiple variables in a print you could just write: Console.WriteLine("Hello my name is {0}, and I like to eat {1}", Billy, Pizza); Where {0} and {1} is replaced with Billy and Pizza respectfully. I am aware that you could use System.out.println("Hello my name is" + Bob +"and I like to eat " + Pizza); but I find the constant + and "" redundant.
11 years ago
Wow this helped a lot, just a little more verification needed though.

I am so use to seeing stuff declared like
int[] array = new int[5];

where the left matches the right. int[]

Could you give me the layout for how "new" works? Is it:

Class <name> = new <class> ?

Automobile myStang = new SportsCar();
Automobile aCamry = new FamilySedan();
MonsterTruck bigfoot = new MonsterTruck();

11 years ago
So implementing would change the type of the class, like type casting?
11 years ago
What would be the difference if I rewrote the code as follows?

public class Dog(){

public void eat(){
//Do stuff
}
public void sleep(){
//Do stuff
}
public void Play(){
//Do stuff
}
}

public class Hippo(){

public void eat(){
//Do stuff
}
public void sleep(){
//Do stuff
}
}
11 years ago
Pretty new to java here, I know extends is for classes and implements is for interfaces. I know that you can only extend one class and implement multiple interfaces. And I think that interfaces have methods without bodies and Classes have methods with bodies?

Here is an example I found online. I don't get the purpose of class Animal and interface Pet. I see that class Dog extends and implements them, but then declares those methods all over again, couldn't Dog just declare those methods on its own without extending or implementing? I think of it like variables. I guess my problem here is that I see Dog could stand on its own without implementing and extending, could some one please clarify? Also, could you implement a Class?

01 abstract class Animal {
02 private String name;
03
04 public void eat();
05 public void sleep();
06 }
07
08 public interface Pet {
09 public void play();
10 }
11
12 public class Dog extends Animal implements Pet {
13 public void eat() {
14 // do stuff
15 }
16
17 public void sleep() {
18 // do stuff
19 }
20
21 public void play() {
22 // do stuff
23 }
24 }
25
26 public class Hippo extends Animal {
27 public void eat() {
28 // do stuff
29 }
30
31 public void sleep() {
32 // do stuff
33 }
34 }
11 years ago