examples 2 Answer(s) 4 years and 3 months ago
Posted in : Java Beginners
View Answers
March 12, 2009 at 5:19 AM
Hi friend,
Code to help in solving the problem :
import java.io.*; class Plaindrome { public static void main(String[] args) {
String string = ""; InputStreamReader input = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(input); // read in user input boolean bool=false;
do{ try { System.out.println("Please enter 5 digit number."); string = reader.readLine(); } catch(Exception e){} int num=Integer.parseInt(string); int rev=0; int rem=0; int n = num; while(n!=0) { rem=n%10; rev=rev*10+rem; n/=10;
} if(num!=rev) { System.out.println("Please enter again valid number"); bool=true; } else { System.exit(0); } } while(bool); } }
Thanks
March 13, 2009 at 1:21 AM
Hi Friend
This is the full code according to your full requirement.
// Code Starts
import javax.swing.*; import java.awt.event.*;
public class Pallindrome{ public static void main(String[] args){ JFrame frame = new JFrame("Calculate Pallindrome"); JButton button = new JButton("Calculate Pallindrome"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ String str = JOptionPane.showInputDialog(null, "Enter some number : ", "", 1); if(str.length() <= 4){ JOptionPane.showMessageDialog(null, "You have entered a " + str.length() + " digit number.", "Calculate Pallindrome", 1); } else { int num = Integer.parseInt(str); int n = num; int rev=0; for (int i=0; i<=num; i++){ int r=num%10; num=num/10; rev=rev*10+r; i=0; } if(n == rev){ JOptionPane.showMessageDialog(null, "Number is pallindrome", "Calculate Pallindrome", 1); } else{ JOptionPane.showMessageDialog(null, "Number is not pallindrome", "Calculate Pallindrome", 1); } } } }); JPanel panel = new JPanel(); panel.add(button); frame.add(panel); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
// Code Ends
Thanks and Regards RoseIndia Team
Related Pages:
examples
examples Hi sir......
please send me the some of the examples... questions .
Hello Friend,
Which type of connectivity examples do you want?Please clarify this.
Thanks
mysql connectivity examples
 
PHP Examples
In this section of PHP examples, the new bees will learn the basic examples of most common used functions. These examples will help to the experts too... examples from several functions to sessions, class and objects.
The examples
HTML5 examples examples to learn in detail with the help of many examples.
Please provide me the urls of HTML5 examples.
Thanks
Hi,
There are many new features... supported by major browsers.
View examples at HTML5 Examples tutorial page
Ajax examples
Ajax examples Hi,
I am Java programmer and I have done programming in Java. Now I am learning ajax from scratch. Tell me the good examples of Ajax.
Thanks
Hi,
Since you have already experience in development
Javascript Examples
JavaScript Examples
Clear cookie example
Cookies can...
In this part of JavaScript examples, we have created a simple example which shows the use... discussed in our previous examples the use of getAttribute()
method. Visit the link
Examples on threads and mulithreading..... Examples on threads and mulithreading..... Is any good examples on threads and Mulithreading...
Hi Friend,
Please visit the following link:
Thread Tutorial
Thanks
need ENUM examples
need ENUM examples i need enum sample examples
Hi Friend,
Visit Here
Thanks
need ENUM examples
need ENUM examples i need enum sample examples
Hi Friend,
Visit Here
Thanks
unable to execute the examples
unable to execute the examples unable to execute the examples given for struts,ejb,or spring tutorials.Please help I am a beginner
HTML5 examples.
HTML5 quick examples.
HTML5 Examples, Definition of <!DOCTYPE > in HTML5.
HTML5 comment tag Example,, Definition of <!-- --> comment tag....
HTML5 input examples, Introduction and implementation of input tag.
HTML5
Java Tutorial with examples
Java Tutorial with examples What is the good urls of java tutorial with examples on your website?
Thanks
Hi,
We have many java tutorial with examples codes. You can view all these at Java Example Codes
Ajax website examples
Ajax website examples Hi,
Provide me the url's of ajax website examples.
Thanks
Hi,
Please see the nice Login and Registration page of Roseindia.net, which demonstrate the capabilities of Ajax frameworks.
Thanks
Examples of optical disk Examples of optical disk What is the example of Optical disk? Please give me at least one example of it.
Digital versatile disks is a example of optical disk
HTML form examples
HTML form examples Hi,
How to create a simple data entry form in HTML and use JavaScript to validate the same. Can anyone share html form examples code?
Thanks
Hi,
Please see the HTML form example page.
Thanks
need ENUM examples
need ENUM examples i need enum sample examples
Hi Friend,
Try the following code:
public class EnumExample
{
public enum Languages{
C, Java, DOTNET, PERL
}
public static void main(String[] args){
int
Need Jar in the JPA examples
Need Jar in the JPA examples JPA - tutorial is good, very easy to understand and simple. But to run the examples, the jar/helping files are needed. and how Hibernates are used in the JPA example?
Thnaks
Abhijit Das
 
Struts Layout Examples - Struts
Struts Layout Examples Hi,
Iam trying to create tabbed pages using the struts layout tag.
I see the tab names on the page but they cannot be clicked on.
Im not able to find simple examples/explanation on it.
Any help
SQL tutorial with examples
SQL tutorial with examples Hi,
I am looking for good SQL tutorial with examples code. Please give me good urls for SQL tutorial with example code which can be downloaded and easily used.
Thanks
Read at SQL Example
PHP Tutorials Guide with Examples
PHP Tutorials Guide with Examples Hi,
I am a beginners in PHP. I have searching for php tutorial guides with examples. Can any one provide me resourceful link.
Thanks,
Hi,
Please read this PHP tutorial
Dynamic html examples
Dynamic html examples Hi,
What is Dynamic HTML? Explain with dynamic html examples.
Thanks
Hi,
DHTML stands for Dynamic HTML and is uses the HTML, JavaScript, DOM, & CSS in a program.
Following is very simple
javascript event handling examples
javascript event handling examples javascript event handling examples
var handleClick = function(e) {
// Older IEs set the `event` globally.
e = window.event || e;
// Older IEs use `srcElement` instead
About Examples
Java NotesAbout Examples
This series of progressive examples shows.... This is the real beginning of the pattern that will
be used in many examples... examples are shown as applications.
However, the programs are organized
JPA Examples
JPA Examples
In this section we will discuss about the examples of JPA.
This section will describe you the various examples that will help you create
JPA applications. In this page you will find various examples like methods of
JPA
Examples of Wrapper Class Examples of Wrapper Class
In this page we are giving you the links of tutorials on wrapper classes in
Java.
Wrapper classes are the classes present in the java.lang package. These
classes provides object methods for the following
Struts 2 tutorial for beginners with examples
Struts 2 tutorial for beginners with examples Where is the Struts 2 tutorial for beginners with examples on your website.
Thanks
Hi... for beginners with examples
Thanks
JSF Examples
JSF Examples
In this section we will discuss about various examples of JSF.
This section describes some important examples of JSF which will help you...
examples, I have tried to list these examples in a sequence that will help you
JSP Examples
JSP Examples
In this section we will discuss about the examples of JSP... will find various examples of JSP which would help you understand
how to work... miscellaneous examples
User Registration Form Using JSP(JspBeans)
Login
php video tutorial for beginners with examples
php video tutorial for beginners with examples php video tutorial for beginners with examples
PHP: Hypertext Preprocessor
PHP is an open source server side scripting language. One can use PHP to create dynamic web
jQuery plugin examples code
jQuery plugin examples code
jQuery plugin examples code
Following are the links of example code with live demos and
downloadable code
Real time examples - Java Beginners
Real time examples what is method overloading,method overriding,constructor overloading concept in java and explain with real time examples? Hi Friend,
Please visit the following links:
http://www.roseindia.net
Sql Examples using php code
Here is the many examples.
In this tutorial we discuss many examples of sql statements using php code
JPA Examples In Eclipse
JPA Examples In Eclipse
In the JPA Examples section we will provide you almost all the examples of
JPA framework. This complete JPA tutorials will illustrate you
Examples - Method and loop review
Java NotesExamples - Method and loop review
Another review examples of Method and loops.
Learn Methods and loops in more detail.
The examples....
// SampleMethods.java -- Shows loop examples inside methods...
// Author: Fred Swartz - 2005
jQuery - jQuery Tutorials and examples
jQuery - jQuery Tutorials and examples
The largest collection of jQuery examples... created many examples of using jQuery.
View the demo's here.
Learn jQuery
Struts 2.3.8 Tutorials and Examples
and examples of Struts 2.3.8.
Struts 2.3.8 is "General... download the examples given here in Eclipse by deploying on the
tomcat server... and test.
Mostly these examples are small examples which gives the complete detail
Ajax Examples
Ajax Examples
There are a few AJAX demos and examples on the web right now. While..., functions, and extensions provided by this library.
As you read the examples