Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Please help me I'm a beginner

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help me I'm a beginner

    public class Ass {
    int [] array ;
     
     
     
    public static void swap(int [] x) {
     
    	for (int i = 0 ; i<x.length ; i++){
    		int b =0 ;
    	for (int j = 0 ; j<x.length ; j++){
     
    		if ( x[i] > x[j] ) {
    			b ++ ;
    		}
    	}
    		if (b!=0) {
    			int temp = x[i] ;
    			x[i] = x[b] ;
    			x[b] = temp ;
     
    		}
    	}
    }
    public static void main (String [] args) {
    	array = new int [] {1,4,5,7,3,0,8} ;
    	Ass.swap(array) ;
    	for  (int i = 0 ; i<array.length ; i++) ;
    	System.out.println(array[i]) ;
    }
    }
    Last edited by pbrockway2; October 13th, 2012 at 09:52 PM. Reason: code tags added


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Please help me I'm a beginner

    Hi alloka, welcome to the forums!

    I've edited your post to add "code" tags. They are described in this faq and detailed in the documentation it links to. The bottom line is that you put [code] at the start of any code and [/code] at the end. That way code will appear formatted and be more readable. (It is also a good idea to check that you have set the code out nicely, with correct indentation and the braces lining up.)

    So, what is the problem with that code? Does it compile?

    If it does not compile, and you can't understand the compiler's messages, post those messages and say which lines of code they are referring to.

    If the code does compile but does not do what you expect or intend at runtime, describe what the code does do and say what you wanted it to do. If there are runtime exceptions, copy and post them.

  3. #3
    Member
    Join Date
    Apr 2012
    Posts
    161
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Default Re: Please help me I'm a beginner

    You should really provide information like what is wrong and what you are having problems with. We can't read minds :s

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Please help me I'm a beginner

    In an answer of the same quality as the question.


    ;

Similar Threads

  1. help me pls (beginner)
    By xsinx in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 21st, 2012, 03:21 AM
  2. Beginner
    By mkarthik90 in forum Member Introductions
    Replies: 1
    Last Post: February 18th, 2012, 02:26 PM
  3. I am a beginner please help :)
    By mvonb17 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 6th, 2012, 03:44 PM
  4. Beginner
    By codejava in forum Member Introductions
    Replies: 2
    Last Post: August 22nd, 2011, 08:11 AM
  5. I need a help ! i am beginner
    By yinky in forum Java Theory & Questions
    Replies: 3
    Last Post: September 30th, 2009, 07:22 AM