help about learning java

If something doesn't fit in any other forum then post it here.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Ectis
Posts: 122
Joined: Tue Dec 22, 2009 6:54 pm

help about learning java

Post by Ectis »

well guys i been here for some time and i learned how to read 79% the java and python but i havent a clue on how to start a script i wont some some links that i can learn the java that is used on l2 some guides i found where veryyy old and many thinks change intime so if u guys be kind and gimi some links i wana help building scripts and finishing unfinished scritps and expand them am a very promising person :D
wasabi2k
Posts: 110
Joined: Sun Oct 08, 2006 4:22 pm

Re: help about learning java

Post by wasabi2k »

well you could start by looking at the .bat script used to startup the gameserver and the main method of the gameserver.java file...
Ectis
Posts: 122
Joined: Tue Dec 22, 2009 6:54 pm

Re: help about learning java

Post by Ectis »

yes but first i must know what the comands mean like Private static int /public final int//public etc. the 80% of time am guesing what they do so am not completely sure so if i see it i dont think i can understand anythink if i dont know what the symbols mean XD
Probe
Posts: 915
Joined: Thu Sep 03, 2009 6:36 pm
Location: Israel
Contact:

Re: help about learning java

Post by Probe »

well it's not that hard to comprehend :)

here's a few pointers:
int = integer (numeric value)
float = a "Real" number, with also values after the decimal '.'
double = also a real number, but with a maximum of 2 values after the '.'
char = A (keyboard) character, or any other character for that matter, it's defined as 'a','1',';' etc...
String = An (sort of) array of characters, which allows to make complete words\sentences\text.

now about the whole 'public' thing - this defines who can "see" our variable:
- public - anyone can see it.
- private - only the specific class in which the variable is defined can see it.
- protected - only the specific class and the classes that extend it can see the variable.

there are also arrays, or collections of variables, which you will see as
int[] objectId - an array of integers
FastList<String> - a list of strings

and as for the final\static thing:
if there's a final before the variable definition - then this variable can(and must be) only be defined once - and this value will remain it's value 'forever'
static - means this variable can be used with a static reference, for example, in L2Character class you will find:

Code: Select all

public static final byte ZONE_PEACE = 1;
and throughout the code you can find static references to id, for example

Code: Select all

if (player.isInsideZone(L2Character.ZONE_PEACE))	return;
L2Character.ZONE_PEACE is a static reference

anyways hope this helped :)
User avatar
Stake
Posts: 383
Joined: Sun Mar 23, 2008 9:33 pm
Location: Hungary
Contact:

Re: help about learning java

Post by Stake »

Also, a static variable is shared in the memory, so when you call one class with a static variable, its variable will not reset to its basic value, but keep the previous modified value. It is useful with increment or decrement cycles too.
For example:

Code: Select all

static class Ize{	private static int novel = 1;	public Ize()	{		novel++;	}	public int getNovel()	{		return novel;	}}
So, each time the class is used...

Code: Select all

Ize hm = new Ize();System.out.println(hm.getNovel());Ize hmm = new Ize();System.out.println(hmm.getNovel());
...the result will be 3 instead of 2.
Image
Image
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: help about learning java

Post by BiggBoss »

starting by
http://java.sun.com/docs/books/tutorial/
will take you into the Java basics.
Then the read book starts. Depending on what you wanna focusing more, here some useful-related to l2j
Concurrent Programming in Java - Doug Lea (Multi-Threading)
Java NIO - Ron Hitchens (New input/output)
Java Network Programming - Eliotte Rusty (morely dedicated to the socket protocol programming and server-side applications)
Image
Ectis
Posts: 122
Joined: Tue Dec 22, 2009 6:54 pm

Re: help about learning java

Post by Ectis »

those are extreme guides thank guys XD but the think i wana focus more is more into ai's and instance's java like baium ai and crystal caverns etc. cuz l2j is missing a lot of retail ai's and instances and i allways wonted to do those they take time but they worth the work and one think i love about that is that if u know those 2 u can even try to complete the crystal caverns or even start deving on the gracia seeds instances that contains bothe instance functions (cuz its instance) and also whole ai's all this into an instance so i think it will be usefull to know these 2 :D :D
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: help about learning java

Post by jurchiks »

what ever you want to do, books are your friends in this matter
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Post Reply