I can understand why nextLine() doesnt work.
If I change nextLine() with next() my input doest take all the phrase 
 case 7:
        System.out.println("Press 1 to post on your wall \nPress 2 to post on a friend's wall");
        int b=scan.nextInt();
        if(b==1){
            System.out.println("What do you want to post?");
            String pm=scan.nextLine();
            Message ms= new Message(loginUser.getUsername(),loginUser.getUsername() +" :"+ pm.toString());
            message.add(ms);
        }
        if(b==2){
            System.out.println("Whose wall do you want to post? (Write his/her username)");
            String ph=scan.next();
            for(int n = 0;  n< users.size(); n++)
            {
                if(!loginUser.getUsername().equals(ph) 
                        && users.get(n).getUsername().equals(ph)){
                    System.out.println("What do you want to post?");
                    String postIt=scan.nextLine();
                    Message me= new Message( ph,ph +" : "+loginUser.getUsername() +" : " + postIt.toString() );
                    message.add(me);
                }
            }
        } 
        luna=false;
        break;
 
     
    