[Show all top banners]

redlotus
Replies to this thread:

More by redlotus
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

Rolemodel
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 its again java problem
[VIEWED 6250 TIMES]
SAVE! for ease of future access.
Posted on 02-18-09 6:21 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 


JAVA 101 level:


Write a Java application that creates an instance of the String class and initializes this instance with a String literal. Use a for loop structure to print the string in reverse order. Implement the following two String member methods to complete the assignment.




  • length( )


  • charAt( )

Write a program to test your class MyStringTest.


Continue to properly document your source code. Write this program as if you were explaining it to someone new to arrays. Fully document your code in such a way newcomers to Java will understand and be able to implement a Java array. Your grade on this assignment will be based on your thoroughness of documentation as well as you correctness of code.


 
Posted on 02-18-09 6:52 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I haven't used sajha for quite a long time, but I think Techguy is still around who can help you, lahure dai is also another option, but if u keep on posting ur assignments in the forums then u r not going to learn anything bro... It clearly mention u r not giving any effort to it, so I suggest you first u should try to do it by urself and post where u went wrong, or in which part of the codes u are confused. If it interests u to visit other forums then http://www.java-forums.org/ is better option for java related problems, most of them will be willing to help you, so, have a luck....

 
Posted on 02-18-09 7:08 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

here u go dude:


import java.io.*;


public class MyStringTest {


            public static void main(String[] args) throws IOException {


                BufferedReader rd = new BufferedReader (


                new InputStreamReader(System.in));


                System.out.print("Enter the string that needs to be reversed: ");


                String S = rd.readLine();


                 System.out.print("The reversed string is: ");


          for(int i=S.length()-1;i>=0; i--)


{


char c=S.charAt(i);


System.out.print(c);


}


}


}


 


Hope this would of some help :D


 
Posted on 02-18-09 7:12 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Have send u an email through sajha..should have got it. :)

 
Posted on 02-18-09 7:17 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

redlotus,

I understand that you are very new to Java, but you should at least allocate some time to ponder the problems. Instead of asking people to write the entire code for ya, you need to put some effort on it. Nobody is perfect, so asking for help is not bad. But asking people to do the entire homework is so absurd.
I am assuming that you are taking java now in the hope of getting a job in the IT field. If you don't aggregate enough knowledge in java now, you won't be able to keep your job!
Since it is 100 level course, it is not that hard to learn if you have self determination to learn java. You are welcome to post java problems in sajha, but please try on your own first.

Good luck,

 
Posted on 02-18-09 10:02 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Please try to solve it by yourself first and if possible post your errors/exception rather than posting the question.

public class StringProblem {
    private String stringInstance;
    private char[] splittedString;

    public StringProblem(String initString) {
        stringInstance = new String(initString);
        splittedString = stringInstance.toCharArray();
    }

    public int length() {
        return splittedString.length;
    }

    public char charAt(int index) {
        return splittedString[index];
    }

    public static void main(String[] args) {
        StringProblem strProb = new StringProblem("NEPAL");
        
        for (int i = strProb.length() - 1; i >= 0; i--) {
            System.out.print(strProb.charAt(i) + " ");
        }
    }
}
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 7 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
जाडो, बा र म……
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters