Java: Java Programming For Beginners a simple Start To Java Programming (Written By a software Engineer)


Download 0.82 Mb.
Pdf ko'rish
bet35/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   31   32   33   34   35   36   37   38   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

Determining String Length
Routines  used  to  get  data  about  an  object  are  known  as  accessor  methods.  One  accessor
technique  that  you  can  use  with  strings  is  the  length()  function,  which  furnishes  a
proportional  payback  of  characters  contained  in  the  string  item.  This  function  can  be
utilized in the following manner:


public class mystring {
public static void main(string args[]) {
String newstr = “I am hungry!”;
int strlen = newstr.length();
System.out.println( “length = ” + strlen ); }
This would create the accompanying result:
length = 12

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   31   32   33   34   35   36   37   38   ...   95




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling