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


Download 0.82 Mb.
Pdf ko'rish
bet50/95
Sana09.01.2022
Hajmi0.82 Mb.
#261112
1   ...   46   47   48   49   50   51   52   53   ...   95
Bog'liq
Java Programming For Beginners - A Simple Start to Java Programming ( PDFDrive )

The void Keyword:
The void keyword permits us to make methods, which don’t give back a value. Here, in
the  accompanying  illustration  we’re  considering  a  void  method.  This  function  is  a  void
method,  which  does  not  give  back  any  value.  Call  to  a  void  system  must  be  an
announcement  i.e.  rankpoints(657.3);.  It  is  a  Java  explanation  which  closes  with  a
semicolon as appeared.
Sample Implementation:
public class Myexample {
public static void main(string[] args) {
rankpoints(657.3);
}


public static void rankpoints(double valfoc) {
if (valfoc >= 100.5) {
System.out.println(“A1 Rank”);
}
else if (valfoc >= 55.4) {
System.out.println(“A2 Rank”);
}
else {
System.out.println(“A3 Rank”);
}
}
This would deliver the accompanying result:
A1 Rank

Download 0.82 Mb.

Do'stlaringiz bilan baham:
1   ...   46   47   48   49   50   51   52   53   ...   95




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