English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

because our prof told us to study bout java... but i dont understand it that much... i just wanna study some a liitle bit of complicated codes... coz' i cant find any in the net or maybe im rerally not gud at finding things in the net... pls n thankyou

2007-07-24 18:18:47 · 4 answers · asked by cutie_boy 2 in Computers & Internet Programming & Design

4 answers

You should start simple . . . reading complicated code will only make you more confused if you don't know the basics. Java is fully documented online and tutorials are everywhere. Just google "java tutorial" and you should get quite a few relevant sites. Good luck!

2007-07-24 18:28:55 · answer #1 · answered by anonymous 7 · 0 1

//Java Programme for checking Palindrome
/*Followings are PALINDROME
// AUTHOR:SRK
madam, straw warts
Ana nab a banana
And E.T. saw waste DNA.
Anna: "Did Otto peep?" Otto: "Did Anna?"
Anne, I vote more cars race Rome to Vienna.
Avid Allen spots a Toyota, stops Nell (a diva.)
Avon sees nova
AddA

*/
import java.awt.Graphics;
import javax.swing.*;

public class Palindrome
{
public static void main (String [] args)
{

String message;

String s = JOptionPane.showInputDialog ("Enter a string");
System.out.println (s.toUpperCase() );
s = palchecking(s);




System.exit (0);
}


public static String palchecking(String s)
{
int len, divpal, mod, endrange;
int ctr=0;


len = s.length();
divpal = s.length()/2;
mod = s.length()% 2;
// char [] pal = new char [s.length()];
endrange = len-1;


/*System.out.println("Length of the String: " + s.length());
System.out.println(divpal);
System.out.println( mod);
System.out.println( endrange);*/

if (mod == 1) {
while (ctr <= s.length() ) {
if (s.charAt(ctr) == s.charAt(endrange)) {
}
else if (s.charAt(ctr) != s.charAt(endrange)) {
System.out.println("******THIS IS NOT A PALINDROME*****");
break;
}
ctr++;
endrange--;
if (ctr > divpal) {
System.out.println("****************THIS IS PALINDROME**************");
break;
}
}
}

if (mod == 0) {
while (ctr <= s.length() ) {
if (s.charAt(ctr) == s.charAt(endrange)) {
}
else if (s.charAt(ctr) != s.charAt(endrange)) {
System.out.println("******THIS IS NOT A PALINDROME*****");
break;
}
ctr++;
endrange--;

if (endrange < ctr) {
System.out.println("****************THIS IS PALINDROME**************");
break;
}
}
}

return s;
}

}


Another Example

//:...ImmutableStrings.java
//Demonstrating StringBuffer

public class ImmutableStrings {
public static void main(String[] args) {
String foo = "foo";
String s = "abc" + foo + "def" + Integer.toString(47);
System.out.println(s);

//The Equivalient using StrinBuffer
StringBuffer sb = new StringBuffer("abc"); //Create String
sb.append(foo);
sb.append("def"); //Creates String
sb.append(Integer.toString(47));
System.out.println(sb);
}
}

2007-07-25 04:44:28 · answer #2 · answered by angel04 3 · 0 1

May be you can contact a java expert. Check websites like http://getafreelnacer.com/

2007-07-25 03:10:08 · answer #3 · answered by Anonymous · 0 1

look here.. www.planet-source-code.com

2007-07-25 01:23:01 · answer #4 · answered by mastercoder35 2 · 0 1

fedest.com, questions and answers