Alright, so this website is really good http://www.tutorialspoint.com/java/java_basic_syntax.htm
I've went ahead and created the first Hello World app, and I sort of understand how each part of the syntax works.
This is what I made:
package EclipsePackage;
public class TuteClass {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Bhowla was here");
}
}
------------
Also, I did this in Eclipse, which is actually more confusing because I did this Hello World program a while ago manually using a text file and JDK.
Going to go through the Terms in this tutorialspoint website, there's so many of them but that's ok, it feels like going back to uni again and taking 1st year programming class. It's harder when there's no lecturer that asks you what each term means every now and then, I guess I have to test myself. It's too late at night now, now it's 1 am, so I'm just going to read the terms before I go to bed.
Learnin' to Java - like a fuggin noob
Tuesday, October 8, 2013
Monday, October 7, 2013
Yesterday I was trying to get a grip on making an interface that reads a text file, and possibly output a text file. But I reckon it was far too ambitious at this stage. I'm going to need to learn something more basic than that. This is the website I found that has several lessons that I can learn to get started with Java http://www.programmingsimplified.com/java-source-codes
It's pretty good and I think I'm going to start by just following the steps in that page. At this stage I'm a bit struggling because I haven't learned anything new in the last couple of years, so my brain's a bit sore trying to take things in. But it's all good, we'll see how I go in the next couple of hours.
Right now it's 10 pm and I'm feeling a bit hungry. So progress might be a bit slow. Regardless, this is the first code that I'm going to try to do. It's a simple Hello World program.
It's pretty good and I think I'm going to start by just following the steps in that page. At this stage I'm a bit struggling because I haven't learned anything new in the last couple of years, so my brain's a bit sore trying to take things in. But it's all good, we'll see how I go in the next couple of hours.
Right now it's 10 pm and I'm feeling a bit hungry. So progress might be a bit slow. Regardless, this is the first code that I'm going to try to do. It's a simple Hello World program.
class First {
public static void main(String[] arguments) {
System.out.println("Let's do something using Java technology.");
}
}
OK. So with this, the class is defined as:
In the Java(TM) programming language, a type that defines the implementation of a particular kind of object. A class definition defines instance and class variables and methods, as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass will implicitly be
So I'm guessing that First is the name of the class.
Public is A Java(TM) programming language keyword used in a method or variable declaration. It signifies that the method or variable can be accessed by elements residing in other classes.
Static is A Java(TM) programming language keyword used to define a variable as a class variable. Classes maintain one copy of class variables regardless of how many instances exist of that class. "static" can also be used to define a method as a class method. Class methods are invoked by the class instead of a specific instance, and can only operate on class variables.
OK. So this is all pretty straightforward. Let's repeat that statement again:
The class is like the vessel.. not sure what public static void means at this stage. But hey, it works
In the Java(TM) programming language, a type that defines the implementation of a particular kind of object. A class definition defines instance and class variables and methods, as well as specifying the interfaces the class implements and the immediate superclass of the class. If the superclass is not explicitly specified, the superclass will implicitly be
Object. So I'm guessing that First is the name of the class.
Public is A Java(TM) programming language keyword used in a method or variable declaration. It signifies that the method or variable can be accessed by elements residing in other classes.
- Variable is An item of data named by an identifier. Each variable has a type, such as
intorObject, and a scope. - Method is A function defined in a class. See also instance method, class method. Unless specified otherwise, a method is not static.<-- this part is interesting, so public static void..
Static is A Java(TM) programming language keyword used to define a variable as a class variable. Classes maintain one copy of class variables regardless of how many instances exist of that class. "static" can also be used to define a method as a class method. Class methods are invoked by the class instead of a specific instance, and can only operate on class variables.
OK. So this is all pretty straightforward. Let's repeat that statement again:
class First {
public static void main(String[] arguments) {
System.out.println("Let's do something using Java technology.");
}
}
Good description for Object, Class, methods and instance variables..
- Object - Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.
- Class - A class can be defined as a template/ blue print that describes the behaviors/states that object of its type support.
- Methods - A method is basically a behavior. A class can contain many methods. It is in methods where the logics are written, data is manipulated and all the actions are executed.
- Instance Variables - Each object has its unique set of
instance variables. An object's state is created by the values assigned
to these instance variables.
From http://www.tutorialspoint.com/java/java_basic_syntax.htm
Great page by the way, will refer to this one.
I'm writing this from work at 3.47 pm. So I'll just publish this one so I wont get confused. I finally got the first Hello World to work, turns out it's println (ln as in line with all lower case).
Sunday, October 6, 2013
Alright, first post.
I'm learning to java for the very first time. Did you know that kids third my age are learning how to code java? Fuckin kids these days, man. Holy fucking shit, these 8-9 year olds are like, pretty damn good. With their minecraft programming and shit. What the fuck is minecraft anyway..
So. Fuck that all, and let's start. Today I'm going to learn how to make a pretty simple program that reads a text file. I need this for work one day. This will make my day job SO much easier. So basically some days I will need to digitise a picture of a plot in a digitising program (like Global Mapper). Then I'll need to put in the coordinates of points in this picture to another text file.It's straight forward, but what's not straightforward is the fact that I have to type in each coordinate manually. It takes A FUCKING LONG TIME, EVERY SINGLE FUCKING TIME. So I need to know how I can make it easier. There was this really shitty diagram, with fucking hundreds of points (I gotta draw a curved elliptical shape and a bunch of squiggly shapes) - and that took me a good couple of days to make a decent plot out of the picture.
I found this link http://www.homeandlearn.co.uk/java/read_a_textfile_in_java.html
Should be good, but what the fuck, is up with the url? Fucking hell, is it a website for stay at a home mums?! I'm guessing they need java to power up their fucking toasters or something. Fuck that. Anyway, this is good. Something to start with.
So I started with this, and I got an error message. FUCK.
package textfiles;
import java.io.IOException;
public class FileData {
public static void main{String[] args} {}
}
It stays I need to put in a ; somewhere. I also need to define void.
Then I added this to another Class object called ReadFile
package textfiles;
import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
public class ReadFile {
}
It's 1.20 am and I got work tomorrow. Will pause this now, and play some CK2 then I'll have to go to bed.
I'm learning to java for the very first time. Did you know that kids third my age are learning how to code java? Fuckin kids these days, man. Holy fucking shit, these 8-9 year olds are like, pretty damn good. With their minecraft programming and shit. What the fuck is minecraft anyway..
So. Fuck that all, and let's start. Today I'm going to learn how to make a pretty simple program that reads a text file. I need this for work one day. This will make my day job SO much easier. So basically some days I will need to digitise a picture of a plot in a digitising program (like Global Mapper). Then I'll need to put in the coordinates of points in this picture to another text file.It's straight forward, but what's not straightforward is the fact that I have to type in each coordinate manually. It takes A FUCKING LONG TIME, EVERY SINGLE FUCKING TIME. So I need to know how I can make it easier. There was this really shitty diagram, with fucking hundreds of points (I gotta draw a curved elliptical shape and a bunch of squiggly shapes) - and that took me a good couple of days to make a decent plot out of the picture.
I found this link http://www.homeandlearn.co.uk/java/read_a_textfile_in_java.html
Should be good, but what the fuck, is up with the url? Fucking hell, is it a website for stay at a home mums?! I'm guessing they need java to power up their fucking toasters or something. Fuck that. Anyway, this is good. Something to start with.
So I started with this, and I got an error message. FUCK.
package textfiles;
import java.io.IOException;
public class FileData {
public static void main{String[] args} {}
}
It stays I need to put in a ; somewhere. I also need to define void.
Then I added this to another Class object called ReadFile
package textfiles;
import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
public class ReadFile {
}
It's 1.20 am and I got work tomorrow. Will pause this now, and play some CK2 then I'll have to go to bed.
Subscribe to:
Comments (Atom)