What's new

Pa help po sa magagaling mag code!!!

Nero Swallowtail

Eternal Poster
Joined
Aug 13, 2020
Posts
465
Reaction
174
Points
280
Anong exception po gagamitin dito? Dun po sa "blank(no answer)". Thanks po
IMG_20210327_140746.JPG
 

Attachments

Wow pati ba naman dito nakakrating yang module ng STI. TS wag ka manghingi ng code gawin mu muna kung may problema un ang i ask mu dito hindi ung buong code grabe ka.
 
Hindi ko po hinihingi yung buong code. Tinatanong ko lang po kung anong "Exception" ang pwedeng gamitin para dun sa "Blank(No Answer)" na Condition, paki intindi po yung caption
 
[XX='Nero Swallowtail, c: 1007644, m: 1752019'][/XX] kaya hinihingi namin ung nagawa mu na para malaman namin san maganda ilagay ung exception ang problema kasi sa mga humihingi ng tulong dito walang nilalapag na codes papano namin ma aanalyze yan? o eto try mu implement.
  • if (Empty()) throw new EmptyStackException(); try mu panu mu malalagay yan.
  • catch(NullPointerException e)
    {
    System.out.print("NullPointerException Caught");
    }
 
[XX='Blueriver, c: 1012264, m: 1035162'][/XX] hindi ko kase alam simulan, bukod sa di tinuro kung pano gagawa ng custom exception, di rin ganong na discuss si array kaya mejo nahihirapan ako
 
ito po simple sample sir, kng hind a, b or c ang naka lagay sa println na array mag execute po ung catch exeption ng try-catch statement.
personally I would use an if/else statement, ung try/catch statement kasi ginagamit ko para sa mga wider range of errors, sa exercise nyu kasi isang error lng (if not a, b or c then error), pero para din ma practice ung try/catch statement.

[CODE lang="java" title="simple try and catch"]public class Main {
public static void main(String[] args) {
//bind letters to array numbers
int a = 0;
int b = 1;
int c = 2;
try {
String[] validLetters = {"a", "b", "c"};//select valid letters
System.out.println(validLetters[c]);//user input here then parse to array
} catch (Exception e) {
System.out.println("User prompt here");
}
}
}
[/CODE]
 
[XX='Nero Swallowtail, c: 1012822, m: 1752019'][/XX] Kaya nga importante na may working codes ka na para dun ma itest ung need mu.
 

Similar threads

Back
Top