Advertise Here

Author Topic: Learn Java, Become One!  (Read 6607 times)

0 Members and 1 Guest are viewing this topic.

Offline Icky

  • SMF For Free Newbie
  • *
  • Posts: 10
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Learn Java, Become One!
« on: February 11, 2007, 09:06:49 am »
Hi,
   I'm An Expert Java Script Coder. I've coded MoparScape Servers. I'm also a (C++) & (H++) Coder. I've coded 57 MoparScape Sources, I've also coded 13 Enemy Territory Server & 1 World of Warcraft Private Servers. I got my experience for The Big Book. You can find this book on the Java.com website.

If you have Coded, or have Coding experience, Please post!

Thankyou.
« Last Edit: February 11, 2007, 09:08:38 am by Icky »
(\_/)
(0 o) You can help him recieve world domination!
 '    '

Offline AA Boy/Smartboy

  • SMF For Free Member
  • *
  • Posts: 59
    • View Profile

  • Total Badges: 13
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Learn Java, Become One!
« Reply #1 on: February 12, 2007, 01:16:32 pm »
I used to code, but not so much any more (have become to lazy).

Offline CRIPZ Chick

  • SMF For Free Newbie
  • *
  • Posts: 4
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 First Post
Re: Learn Java, Become One!
« Reply #2 on: February 27, 2007, 10:14:21 am »
I am a professional coder and (C++) & (H++) Coder. If you wanna learn java i could give you a link to all the ebooks and books which u can read for free this is where i leanred my (C++) & (H++) and java scripting and teher are alotta other books also availible :: http://www.b213.net/index.php?id=java i hope it helps you!;)

Offline oblakastouf

  • SMF For Free Newbie
  • *
  • Posts: 1
    • View Profile

  • Total Badges: 10
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 First Post
Re: Learn Java, Become One!
« Reply #3 on: March 17, 2007, 02:02:24 am »
Haha... Im pro java...

The Chapters:
The List Of String Methods

  • 1 - charAt(int)
  • 2 - indexOf(String)
  • 3 - indexOf(String, int)
  • 4 - lastIndexOf(string)
  • 5 - lastIndexOf(string, int)
  • 6 - length()
  • 7 - String To Double/Int
  • 8 - String Concatination
  • 9 - toLowerCase()
  • 10 - toUpperCase()
  • 11 - trim()
  • 12 - compareTo(string, string)
  • 13 - equals(string, string)

Chapter One:
Using charAt(int)

The charAt(int) can be used in various instances... like when you are expecting the user to be a complet dunce, or, imperfect. charAt(int) reads a single "Char" data type  at the indicated location inside the parenthese.

EXAMPLE:
This is a simple program that takes a string and returns the first char.
Code: [Select]
public char kunk()
{
String kunk = "awesome";
char rocks = kunk.charAt(0);
return rocks;
}

The first char in a string gets 0, the second 1, the third 2, and so on...


Chapter Two:
Using indexOf(String)

IndexOf(String) is mostly used for searching a string for a certain word, phrase or single letter. It searches the entire string until it finds one then stops. It then returns the number that the occurance happened...

EXAMPLE:

Code: [Select]
public int hardcore()
{
String kunk = "I rock harder than j00";
int lol = kunk.indexOf("I");
return lol;
}

The return output of such a coding would be 0, because the first uppercase i was in the FIRST position of the string, kunk, refer to chapter one for the reason why it returns 0 instead of 1.


Chapter Three:
Using indexOf(String, int)

indexOf(String, int) is more specific. The int that you input into indexOf(String, int) is the determining factor of what it will find. This one is a lot more complicated to use. The int puts a restricton on what parts of the string it will search. For instance... if you put a 3 in the int space as such...

Code: [Select]
String kunk = "lol bitch";
kunk.indexOf("lol", 3)

... It would find nothing and be enable to return anything due to your current restrictions. But by using the one in chapter two or changing String kunk to...

Code: [Select]
String kunk = "bitch lol";
kunk.indexOf("lol", 3)

... It would return 7, because it was able to find lol within the set restrictions ;)


Chapter Four:
Using lastIndexOf(String)

This is the exact same concept of Chapter two, but it scans the entire string for it and returns the LAST one it finds, it also returns an int.

EXAMPLE:
Code: [Select]
public int kunk()
{
String kunk = "lol kunk lol";
int lol = kunk.lastIndexOf("l");
return lol;
}

It returns the LAST l in the String so it would return 11.


Chapter Five:
Using lastIndexOf(String, int)

Ok, I'm gonig to let you use your brains to put two and two together on this one. And I'll give a breif discription with no example.
(See chapters 3 and 4 to get the fundaments of this one)

Returns the position of the last occurence of the string that you input, the search begins in reverse at the int you input...


Chapter Six:
Using length()

length() returnsthe length of the specified string, real simple, real useful ;)

EXAMPLE:
Code: [Select]
String kunk = "kunk"
int boop = kunk.length();
return boop;

It would return 3. Now woah wait a minute... Yes I did say three... Most, if not all string operators work on the basis of numbers from 0 on up... So if you want the REAL length you need to do...

Code: [Select]
String kunk = "kunk"
int boop = kunk.length() + 1;
return boop;

Movin' on to bigger and better things :)


Chapter Seven:
String Conversions!

Now... Everyone is probably wondering how to change a string that is a number into a Double or an int right?!?! I AM!!! ...If you're still reading this I'm amazed, good job.

You need to use parseInt and parseDouble to do these next activities. Double.parseDouble(String) converts a string to a double, and Integer.parseInt(String) coverts a string to an int.

EXAMPLE:
Int...
Code: [Select]
String kunk = "55555"
int kunk2 = Integer.parseInt(kunk);
return kunk2;

Double...
Code: [Select]
String kunk = "55555.55"
int kunk2 = Double.parseDouble(kunk);
return kunk2;

This has many uses as you can not readily do calculations with strings.


Chapter Eight:
String Concatination

You've most likely seen this before. It is the  most widely used, and never thought about String method used to date. You take it for granted! It is used by putting variables into a print method easier than normal using + signs... Some examples are below.

EXAMPLE: (monkey is a variable)
Without String concatination...
Code: [Select]
System.out.print("I think ");
System.out.print(monkey);
System.out.print(" kunk rocks!");

With It...
Code: [Select]
System.out.print("I think " + monkey + " kunk rocks!");

Chapter Nine:
Using toLowerCase()

toLowerCase() pretty much does what it implys. It takes a string and converts all the letters of the string to lowercase, so, if you were wondering how runescape keeps you from yelling all the time, there it is!

EXAMPLE:
Code: [Select]
String kunk = "SELLING D CHAIN";
String lowercasekunk = kunk.toLowerCase();
return lowercasekunk;

It'd return "selling d chain"


Chapter Ten:
Using toUpperCase()

Polar opposite of chapter nine, see example.

EXAMPLE:
Code: [Select]
String kunk = "selling d chain";
String lowercasekunk = kunk.toUpperCase();
return lowercasekunk;

It'd return "SELLING D CHAIN"


Chapter Eleven:
Using trim()

trim() is an uncommonly used String method because it is very rarely needed. trim() takes off the "WhiteSpace" charecters at the begining and end of a string... So basically it deletes the unneeded chars at the beginning and end of your string input, I'm not even 100% sure what the output of it is... So i won't give an example...


Chapter Twelve:
Using compareTo(string, string)

Ok, this one is not as useful as the on in chapter thirteen but it's useful nonetheless... If the first string comes alphabetically before the second it returns a negitive number...

Code: [Select]
compareTo("kunk", "zebra")
If they are equal it returns 0.

Code: [Select]
compareTo("kunk", "kunk")
If the first comes alphabetically after the second it returns positive.

Code: [Select]
compareTo("kunk", "blue")

Chapter Thirteen:
Using equals(string, string)

equals(string, string) is one of the rare boolean return methods of the string family. it returns true or false based on the two strings... it's very simple really. If inputted string one is the same as two it returns true. Or else it returns false.


Offline doggiedoo86

  • SMF For Free Member
  • *
  • Posts: 69
    • View Profile
    • Grand Gaming

  • Total Badges: 14
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: Learn Java, Become One!
« Reply #4 on: July 11, 2007, 12:40:04 pm »
i have coded a oparscape server... and its my server!

 

Related Topics

  Subject / Started by Replies Last post
20 Replies
14469 Views
Last post June 05, 2008, 06:34:37 am
by Crasy
3 Replies
2059 Views
Last post March 19, 2007, 02:49:53 pm
by Crasy
0 Replies
5929 Views
Last post February 04, 2008, 07:27:04 pm
by slayer766
0 Replies
1075 Views
Last post May 05, 2008, 05:36:39 pm
by Firestar
3 Replies
3659 Views
Last post June 04, 2008, 11:26:18 pm
by guest4485