zondag 3 april 2011

Reading another tutorial on classes. (Rocket and JetPlane Class)

I am reading another tutorial. It is in another language so I will not place the link here.

I find it difficult to understand. The sourcecode is spread into different parts. There is no complete copy and paste and compile code to see.

Using classes example :
 
// Snippet / Example - Does not compile
public class Rocket {    
    public String rockettext = "Mach 2 Rocket";    
    public Rocket() {
    }
}

public class JetPlane {    
    public JetPlane() {
    }    
    public static void main(String[] args) {        
        Rocket Projectile = new Rocket();        
        System.out.println(Projectile.rockettext);    
    }    
}

// Different class of JetPlane
// Modify Rocket class rockettext
public class JetPlane {    
    public JetPlane() {
    }    
    public static void main(String[] args) {        
        Rocket projectile1 = new Rocket();        
        Rocket projectile2 = new Rocket();
        projectile2.rockettext = "Mach 2.5 Rocket";       
        System.out.println(projectile1.rockettext);
        System.out.println(projectile2.rockettext);
        System.out.println(projectile1.rockettext);
    }
}


There was a man shouting outside not that long ago. He shouted things like "fuck off". Usually it is pretty quiet. But there are a lot of thieves in my neighbourhood. If you leave your door open they will enter and take things. Also if you leave something outside then it will dissapear.

I read something about something called concat that binds 2 strings together. Not to sure though.
Google can show you what a word means if you place the word and double point define: followed by a word behind it. Useful feature.

I opened up a cold beer and am reading the class tutorial.

I still am not to sure how the word void is used in java. Sometimes I see it being used and sometimes it is not being used. void is a word you use if a method does not return anything. But I see methods that have no void and no return word in it. (weird)

O boy, The overloading part of the tutorial is here. Constructors and overloading.

I read that overloading is making two of the same named methods one of them being the class constructor that is named the same af the class.

A part of the tutorial is about the this word in java. It does not make sense.

Next part is recursion. (search for ' flood fill recursion ' using google)

One thing that I just learned is that you can create variables in if statements and they can only be used in the if part of the code.

You can delete the methodnames that you made with = null;

Ok the page is read.

Geen opmerkingen:

Een reactie posten