Illegal start of expression

Hello I just started a new java course at uni without having any java experience before.

i am trying to write a quicksort code but i get the message:

Illegal start of expression

when i try to compile a part of my code.

The compiler highlights the underlined code:

public class Quicksort

{

public static void main(String[] args)

{

/*this code will give an array with all numbers larger or equal to the pivot

at its right and all numbers smaller at its left*/

int [] v; int l = v.length; int i=0; int j= l-1; p=v[0]; int k=0;

//[6,3,8,7,9,4,5,2,1]

void quickSortInner ([]v, i, j)

{

for (i<=l; i++)

{

if v[i+1]<p

{int a = v[i+1];

v[i+1] = p;

v = a;

k++;

}

[...]

Message was edited by:

Iced_jacob

Message was edited by:

Iced_jacob>

[931 byte] By [Iced_jacoba] at [2007-11-26 23:39:46]
# 1
Could you repost that using code-tags, please?See: http://forum.java.sun.com/help.jspa?sec=formatting
prometheuzza at 2007-7-11 15:05:50 > top of Java-index,Java Essentials,Java Programming...
# 2

The compiler highlights the underlined code:

public class Quicksort

{

public static void main(String[] args)

{

/*this code will give an array with all numbers larger or equal to the pivot

at its right and all numbers smaller at its left*/

int [] v; int l = v.length; int i=0; int j= l-1; p=v[0]; int k=0;

//[6,3,8,7,9,4,5,2,1]

public void quickSortInner(int []v, int i, int j)=

{

for (i<l; i++)

{

if v[i+1]><p

[...]

>

Iced_jacoba at 2007-7-11 15:05:50 > top of Java-index,Java Essentials,Java Programming...
# 3

It looks like your quick sort method is inside the main method. You cannot do this. It should look like this:public class Quicksort {

public static void main(String[] args) {

// ...

}

public void quickSortInner(...) {

}

}

There is also an "=" sign after quickSortInner(int []v, int i, int j) which shouldn't be there.

And try to use new lines! This is just horrible:int [] v; int l = v.length; int i=0; int j= l-1; p=v[0]; int k=0;

prometheuzza at 2007-7-11 15:05:50 > top of Java-index,Java Essentials,Java Programming...
# 4
Thanks a lot. but is there a problem if I initialise the variables before i declare the quicksort code?
Iced_jacoba at 2007-7-11 15:05:50 > top of Java-index,Java Essentials,Java Programming...