Find out last character of array

Ads
 

Find out last character of array

How we can find out the last character of array in java program ?

View Answers

June 12, 2012 at 4:43 PM

Example:-

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

        String str = "facebook";

        char chars[] = str.toCharArray();

        int charPosition = chars.length - 1;

        System.out.println(chars[charPosition]);

    }
}

Output

 K

Description:- The given Example find out the last character of a string. We have a created a class named MyStringExample. In the main method, we have declared a string variable ‚??facebook‚??.now next step we will be used method ‚??int charPosition = chars.length ‚?? 1‚??

Ads









Related Tutorials/Questions & Answers:
Find out last character of array
Find out last character of array  How we can find out the last character of array in java program
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check
Advertisements
find all unique character in string using java
find all unique character in string using java  example: hello how are you. output should be waryu
array find all possible dimension
array find all possible dimension  Given array: int[] dimension = { 1, 2, 3 }; That produces the output: 1 2 3 12 13 23 123 I'm new to array...i can't figure out the way on even how to start... any idea?...really appreaciate
Mysql Date Last 30 Days
; Mysql is used to find out the last 30 days from current date... days'. To grasp this concept we find out the current date. The Syntax used to find out the current date:  curdate ( ) :The Query curdate ( ) help you to find
To find first two maximum numbers in an array
To find first two maximum numbers in an array  Java program to find first two maximum numbers in an array,using single loop without sorting array
How to find out the friend user between two columns in sql database
How to find out the friend user between two columns in sql database  Hi, Can any one please tell me ..how to find out the friend user between two columns in sql database? In other words i wanted to get the corresponding data from
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
To find first two maximum numbers in an array,using single loop without sorting array.
To find first two maximum numbers in an array,using single loop without sorting array.  Java program to find first two maximum numbers in an array,using single loop without sorting array
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
plz give me program to this: Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1
2. Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
2. Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1 Abracadabra, 2 Abracadabra, 3
Find Array element from index using GUI
Find Array element from index using GUI In this tutorial, you will learn how to create an GUI application to find an array element from its index. For this, we have created an an array of 100 randomly chosen integers and allow
find out in servlet which button was clicked on an html page
find out in servlet which button was clicked on an html page  i have two buttons on my jsp page... and i want two call two seperate codes in a servlet on pressing of those 2 buttons.. how do i find out which button was clicked so
last question
last question   Input the name and marks of 25 students and compute the average. Print out the name and average of each student. (You can do this using an array or without using an array
how to find inverse of n*n 2d array in java
how to find inverse of n*n 2d array in java  I reached upto code of printing the matrix as: Assume that matrix is square matrix where row=column code is: public class ReadContents{ public static void main(String args
please please i wanna insertion sort program find calendar to array value (1000,5000,10000), please help me
Insertion sort program find calendar to array value 1000,5000,10000  program find calendar for insertion sort in jfram to array 1000
how to find subarray from given large 2d array of arbritary dimension
how to find subarray from given large 2d array of arbritary dimension  my code is: import java.lang.*; import java.io.*; import java.io.File; import... to print the subarray of any dimension from given array file. i have tried upto
cannot find symbol class array queue--plzz somebody help..
cannot find symbol class array queue--plzz somebody help..  import java.util.*; public class Test { public static void main(String[] args) { ArrayQueue<String> q = new ArrayQueue<String>(6); System.out.println
Array
Array  how can i use elements of an array in a circular form? that is if the searching of the element reach the last elements of the array, then it will start serching from the begining of the array
Finding Last Modification Date of a file
Get the Last Modification Date      Get the Last Modification Date This section contains the detail about how to get the last modification date of a file
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE  Hello Sir,, Good Morning Actually i have been assigned a task in my college to create a new mobile application and in that i've
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE  Hello Sir,, Good Morning Actually i have been assigned a task in my college to create a new mobile application and in that i've
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE
HOW TO FIND OUT GPS COORDINATES WITHOUT USING ONLINE DATABASE OR OTHERTHING ON MOBILE  Hello Sir,, Good Morning Actually i have been assigned a task in my college to create a new mobile application and in that i've
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??  import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class add1 extends MIDlet implements
JavaScript array position
;  In this section of JavaScript array tutorial we have to find... by which we can find the position of the array item therefore we have created...">   <h2>    JavaScript array find position
How to Print Array in JavaScript
;; There are some methods of array that can use in array like length() can find...How to Print Array in JavaScript In this section you will learn about Array in JavaScript. Array are important part of all programming languages. Array
Character class
Character class   Character defines the forDigit();,digit()methods..how can these b used and wht does radix point signify here.i want to knw what... out to b -1.. why is it soo??..pls post a code on this with radix
array
accepts a pointer to integer which represents an array of integer.After that this method prints the entire of the array numbers to the monitor. include using std::cout; using std::endl; void printArray(int *array, int count
How to display string or character
How to display string or character  how to print character or a word without using array concept
Array's
Array's  I have to finish an "order page". that checks 2 dropdown... line at a time, then calculate a total. I know I need to create an array, but I'm having a hard time figuring out the loop. I just need a little help to get
Array of String using Pointers
of string using pointers in C. The declaration of an array of character pointers.... In the example below, A two element array of character pointers where each element is a pointer to a character. We have initialized the array with two elements by giving

Ads