[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
>that moment when you realized you were too stupid for CS
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 67
Thread images: 9
File: Untitled.png (31 KB, 583x823) Image search: [Google]
Untitled.png
31 KB, 583x823
>that moment when you realized you were too stupid for CS
I can't even begin to understand what the purpose of this is.
>>
Java isn't computer science, it's software engineering.
>>
First day of CS class?
>>
>>53046694
Better to realize it now and get out.

Great on you anon for being proactive.
>>
This is the easiest fucking code. Just give up already
>>
It seems pretty easy to follow to me. I don't think it really has a legitimate purpose beyond showing how exceptions work though.
>>
>>53046694
>Looping...
>Entering Level 1
>Entering Level 2
>Foo
>ABC
>Bar
is this correct?
>>
>>53048336
Wrong
>>
>>53046694
It looks like just a bunch of exception cases.

The "try" keyword is used to attempt to try a block of code. If the code fails to execute, then it'll throw an exception.

You can try to "catch" these exceptions, by having it print what went wrong, or in this case, print "123", "ABC" or whatever.
>>
>Looping...
>Entering Level 1
>Entering Level 2
>ABC123
>Bar

Was I close? Never used exceptions in C++ before.
>>
>>53048424
>C++

lel
>>
>>53046694
The code will go through that first block, which calls level1()
level1() calls level2(), which in turn calls level3()

level3()'s only purpose is to throw the exception Ex2()

Ex2() will throw a new Exception("ABC")

Catching this results in throwing new Exception"ABC123"), which will be printed due to the outermost catch.

Then, I THINK:
The statement within the finally block will excuse, and then the outer finally will execute

So it's
>Looping...
>Entering Level 1
>Entering Level 2
>ABC123
>Foo
>Bar

or switch ABC123 and Foo
Check the internet for catch/finally execution or try it yourself!
>>
>>53046694
That isn't CS.
>>
>>53048493
If he can't follow logic, it's probably not for him.
>>
CS is not about programming
>>
>>53046694
Looping...
Entering Level 1
Entering Level 2
Foo
ABC
Bar
>>
>>53048424
>C++
Bait
>>
>>53046694
Babby tier stuff desu senpai. Maybe you're right.
>>
File: Brendan_Fraser_cropped.jpg (98 KB, 837x892) Image search: [Google]
Brendan_Fraser_cropped.jpg
98 KB, 837x892
>>53046694
Looping...
Entering Level 1
Entering Level 2
Foo
ABC123
Bar

easy
>>
>>53048528
Why is Foo above ABC?
>>
>>53048572
>>53048528
>>53048481
>>53048424
>>53048336

>every single answer is different
>hey guys it's easy

so
who's correct?
>>
>>53048613
These:
>>53048572
>>53048528
and I guess
>>53048481


I'm guessing the others didn't spend enough time actually looking at it and rushed an answer.
It's not difficult.
>>
>>53048613
Me
>>
>>53048576
because it's wrong
>>
>>53048627
Wait nevermind
>>53048528 is wrong
>ABC
idiot blew it
>>
The purpose is probably to learn how fucked up and stupid exceptions are.
>>
File: 1455814896653.png (62 KB, 583x823) Image search: [Google]
1455814896653.png
62 KB, 583x823
>>
>>53048692
They're very valuable when used in moderation, but in this case, it's just completely retarded and falls into spaghetti tier shit.
>>
Looping...
Entering Level 1
Entering Level 2
ABC
Bar
>>
>>53048719
>ABC

Reading difficulties?
>>
>entering level1
>level2()
>leaving level 1

level2()
{
entering level 2
level3()
leaving level 2
}


WAT
>>
>>53048719
This answer is correct. It wasn't hard
>>
>>53048796
>WAT
Enjoy being outsourced to prajeets
>>
File: 1409621689327.gif (1 MB, 350x117) Image search: [Google]
1409621689327.gif
1 MB, 350x117
>>53048796
your kidding right?
>>
>>53046694
>entering level 1
>entering level 2
>abc
>bar

This can't be that hard. I don't even know the language syntax of this. Java? C#?
>>
someone just type the shit up in eclipse or something already and prove it.
>>
File: Academic Transcript.png (598 KB, 1036x2761) Image search: [Google]
Academic Transcript.png
598 KB, 1036x2761
I fully realize this feel
>>
>>53048839
Java
You're wrong.
That ABC exception will be caught by the ABC123 thing.
>>53048871
>Implying anyone develops in Java at home
AHAHAHAHA
Even Android dev can be done in C++ now.
>>
>>53048336
I guess catch comes before finally.
>>
>>53048811
Except for fact it's wrong?

> System.out.printIn(ex.Message());

You know what this does right? It prints ABC123, the exception message from "Exception ex".
>>
File: 1453501544414.jpg (338 KB, 694x642) Image search: [Google]
1453501544414.jpg
338 KB, 694x642
>>53048885
>Grade: W
>>
Fuck dude I've taken C++ 1 and 2 at uni and i still don't understand exceptions. Something about throwing and catching or some shit.
>>
>>53048968
LOL
>>
File: zzz000000.jpg (38 KB, 634x720) Image search: [Google]
zzz000000.jpg
38 KB, 634x720
>>53048968
>Something about throwing and catching or some shit.
didn't you go to baseball class?
>>
>>53048968
They're the same as fucking if-else statements.

holy shit guys
>>
>>53048924
I'm going to assume it stands for "Withdrawn", as in, he quit CS.

It can also stand for "Wonderful, now you won't keep wasting time you could actually use for educating yourself".
>>
File: firefox_2016-02-18_19-41-21.png (67 KB, 1386x920) Image search: [Google]
firefox_2016-02-18_19-41-21.png
67 KB, 1386x920
Satisfied?
>>
>>53049025
finally

lmao
>>
>>53049025
thats wrong
>>
>>53049008
>>53048991
>>53048994
Both classes, exceptions were something they covered at the very very end and it wasn't on the final and we didn't do any actual coding with them.
>>
>>53046694
Its a quiz
>>
>>53049033
URGH
>>
>>53049041
You don't code and improve yourself in your free-time?
>>
File: code.png (133 KB, 1676x1050) Image search: [Google]
code.png
133 KB, 1676x1050
>>53046694

Looping...
Entering Level 1
Entering Level 2
Foo
ABC
Bar
>>
>>53048839
DUMBASS

>>53048719
DUMBASS

>>53048572
DUMBASS

>>53048481
DUMBASS

>>53048424
DUMBASS
>>
>>53048336
Who knew the first reply with an answer was the correct one.
>>53049119
>Calling people dumbasses after two people actually typed it up
Nice one
>>
Having taken 3 CS courses, all focused on C and C++ (Intro to Cs 1&2, basic ADTs), it's kind of sad they literally never mentioned exceptions.
>>
>>53049084
Its hard to code when you don't know what to make
>>
>>53049149
https://projecteuler.net/archives
>>
>>53049146
That's because it's "lazy" programming. They don't want students to just wrap everything in exceptions, instead writing very carefully crafted code.

Which is why a CS assignment could take over a day, instead of in a production environment of a similar task taking maybe an hour.
>>
>>53048885
Yeah, mine looks that just with more Fs/Cs. Luckily I switched to IT so I was able to skip most classes and the few I had left were pretty easy.

Now I have an undergrad in IT and am trying the master's gig. If it doesn't work out, who cares? I have a degree already.
>>
>>53049463
Nice I work an honest retail job
>>
>>53049612
I got no job lol. Probably going to have to move to find a job. There's jack shit here.
>>
Fuck I hate the stupid everything is an object approach of Java.
>>
you haven't even hit real CS yet. if you think exceptions are hard, wait for algorithm analysis and friends
>>
>>53051976
The actual logical underpinnings of algorithms are far easier and more intuitive than learning the grammar and syntax of a language imo.
>>
>Looping...
>Entering Level 1
>Entering Level 2
>ABC
>foo
>bar

Nested catches. Level 3 is called within level 2 which is called within level 1 which is called within the nested try catch statement. Level 3 catches the ex2 exception which feeds abc into the first exception catch which outputs ABC. The finally field is executed in the first nest outputting foo followed by bar that is output by the first try catch.

Because the loop is inside the try catch that had an exception thrown, it is not executed multiple times.
Thread replies: 67
Thread images: 9

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.