🔒 Closed Pa help po sa magagaling mag code!!!

Status
Not open for further replies.
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.
 
Status
Not open for further replies.

About this Thread

  • 16
    Replies
  • 833
    Views
  • 8
    Participants
Last reply from:
Blueriver

Trending Topics

Online now

Members online
1,110
Guests online
3,341
Total visitors
4,451

Forum statistics

Threads
2,294,439
Posts
29,090,964
Members
1,207,321
Latest member
jasimjasim
Back
Top