Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
fst
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String ar[]) { //String str="word"; //for(int i=0; i < strArray.length; i++){ //System.out.println(strArray[i]); System.out.println("Palin status of the word is :-"+ Rextester.palin("DeleleleD")); } public static boolean palin(String word){ //String arr[]=new String[]{"word"}; String words=word; char[] arr=words.toCharArray(); int j=arr.length-1; System.out.println("value of j " +j); boolean flag=true; for(int i=0;i<arr.length;i++) { if(arr[i]==arr[j]) { System.out.println("true"); } else { System.out.println("false"); flag=false; } j--; } if(flag==false) return false; else { return true; } } }
[
+
]
Show input
Compilation time: 0.62 sec, absolute running time: 0.13 sec, cpu time: 0.12 sec, memory peak: 18 Mb, absolute service time: 0,76 sec
edit mode
|
history
|
discussion
value of j 8 true true true true true true true true true Palin status of the word is :-true