• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:22
CEST 21:22
KST 04:22
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 1 - Final Week6[ASL19] Finals Recap: Standing Tall15HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Esports World Cup 2025 - Brackets Revealed18Weekly Cups (July 7-13): Classic continues to roll8Team TLMC #5 - Submission extension3Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced7
StarCraft 2
General
Who will win EWC 2025? Esports World Cup 2025 - Brackets Revealed Crumbl Cookie Spoilers – August 2025 Heaven's Balance Suggestions (roast me) The Memories We Share - Facing the Final(?) GSL
Tourneys
Sea Duckling Open (Global, Bronze-Diamond) FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament RSL: Revival, a new crowdfunded tournament series $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response
Custom Maps
External Content
Mutation # 482 Wheel of Misfortune Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome
Brood War
General
Flash Announces (and Retracts) Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ Soulkey Muta Micro Map? BW General Discussion [ASL19] Finals Recap: Standing Tall
Tourneys
[Megathread] Daily Proleagues 2025 ACS Season 2 Qualifier CSL Xiamen International Invitational Cosmonarchy Pro Showmatches
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread CCLP - Command & Conquer League Project The PlayStation 5
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
[Manga] One Piece Korean Music Discussion Movie Discussion! Anime Discussion Thread [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Ping To Win? Pings And Their…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 671 users

Homework thread

Forum Index > Closed
Post a Reply
Normal
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
Last Edited: 2009-05-28 00:29:46
May 28 2009 00:28 GMT
#1
Java: Exception Handling + Process Endin's.

1) I'm just having trouble figuring out what's wrong.

2 *If a mod closes this... just ban me from site , christ.
I seriously remember helping people with "homework" countless times - and this isn't even that. This, SHOULD be working, actually, but it isn't.


I have this simple program, with three classes; Starter contains the main, which does nothing but initialize the UserInput class. Inside the UserInput class is where I'm having the problem. Basically, where it throws the exception, it is ending the process, despite catching it. How would I modify this so that the exception gets handled, and the process continues?
public class Starter{

public static void main(String[] args){

UserInput ui = new UserInput();

}
}

And:

public class StringTooLongException extends Exception{

public StringTooLongException(){
}

public String getMessage(){
return "String has more than the max allowed characters.";
}

}

And:

import java.util.Scanner;

public class UserInput{

public UserInput(){

try{
String done = "DONE";
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
/**
* Here is the problem, it is ending the process,
* when it is obviously catching the exception.
*/
throw new StringTooLongException();
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}
}


I've tried so many things, and to be honest I'm quite angry -_- , considering I have (basically) the same code in these three classes:

import java.util.Scanner;
public class Starter {

public static void main(String[] args) {

String done = "DONE";
System.out.println("DocType? U = Unclassified, C = Confidential, P = Proprietary.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String docType = scan.next();
while(docType.compareTo(done) != 0){
Document doc = new Document(docType);
System.out.println(doc);
docType = scan.next();
}
System.out.println("Program Fin~");
}

}

And:

public class Document {

private String dType = "U";
public Document(String docType){
try{
if( docType.compareToIgnoreCase("U") != 0
&& docType.compareToIgnoreCase("C") != 0
&& docType.compareToIgnoreCase("P") != 0 )
throw new InvalidDocumentCodeException();
dType = docType;
}
catch(InvalidDocumentCodeException e){
System.out.println("Exception caught and handled! Continuing...");
System.out.println(e.getMessage());
}
}

public void setDocType(String docType){
dType = docType;
}
public String toString(){
return "Document type: "+ dType.toUpperCase();
}
}

And:

public class InvalidDocumentCodeException extends Exception{

public InvalidDocumentCodeException(){
}

public String getMessage(){
return "Document code must be U (Unclassified), C (Confidential), or P (Proptietary)." +
"\nDocument will default to Unclassified.";
}

}


Thanks muchly! :/
"come korea next time... FXO house... 10 korean, 10 korean"
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 00:38 GMT
#2
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol
Moderatorsometimes I get intimidated by the size of my right testicle
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 00:44 GMT
#3
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?
Moderatorsometimes I get intimidated by the size of my right testicle
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 00:49 GMT
#4
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)
"come korea next time... FXO house... 10 korean, 10 korean"
Abydos1
Profile Blog Joined October 2008
United States832 Posts
May 28 2009 00:53 GMT
#5
On May 28 2009 09:28 HeavOnEarth wrote:
Show nested quote +

import java.util.Scanner;

public class UserInput{

public UserInput(){

try{
String done = "DONE";
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
/**
* Here is the problem, it is ending the process,
* when it is obviously catching the exception.
*/
throw new StringTooLongException();
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}
}



If you're talking about this one the exception keeps going up the stack until it gets caught or the program ends, thus its getting out of the while loop.
"...perhaps the greatest joy possible in Starcraft, being accused of being a maphacker" - Day[9]
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 00:54 GMT
#6
Maybe you should stop being so defensive and read the fucking solution for a change.

On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code



Your catch block is outside of the while loop, so it doesn't continue in the while loop after it executes the catch block. Java does not magically read your mind. This wasn't supposed to work. This isn't some obscure error. This is you skipping through whatever 'How to handle exceptions' guide you read, copy pasting some stupid shit that you don't understand, and asking tl to fix your errors.
Moderatorsometimes I get intimidated by the size of my right testicle
qrs
Profile Blog Joined December 2007
United States3637 Posts
Last Edited: 2009-05-28 00:56:07
May 28 2009 00:55 GMT
#7
^yes, but your catch block is outside the while loop. It's the same as if you would have used goto in C.
edit: Rage pre-empted me
'As per the American Heart Association, the beat of the Bee Gees song "Stayin' Alive" provides an ideal rhythm in terms of beats per minute to use for hands-only CPR. One can also hum Queen's "Another One Bites The Dust".' —Wikipedia
Malongo
Profile Blog Joined November 2005
Chile3472 Posts
May 28 2009 00:55 GMT
#8
I dont understand this program does exaclty what you want imo. LOL.
Help me! im still improving my English. An eye for an eye makes the whole world blind. M. G.
Malongo
Profile Blog Joined November 2005
Chile3472 Posts
May 28 2009 00:56 GMT
#9
On May 28 2009 09:49 HeavOnEarth wrote:
Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

Show nested quote +
On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)

Catch is outside the loop... -_-
Help me! im still improving my English. An eye for an eye makes the whole world blind. M. G.
micronesia
Profile Blog Joined July 2006
United States24673 Posts
Last Edited: 2009-05-28 01:05:21
May 28 2009 00:57 GMT
#10
I love how you didn't put java or programming or anything like that in the thread title lol

I also like how I have absolutely nothing to contribute as I don't remember java at all.
ModeratorThere are animal crackers for people and there are people crackers for animals.
Abydos1
Profile Blog Joined October 2008
United States832 Posts
May 28 2009 00:58 GMT
#11
http://java.sun.com/docs/books/tutorial/essential/exceptions/
"...perhaps the greatest joy possible in Starcraft, being accused of being a maphacker" - Day[9]
Malongo
Profile Blog Joined November 2005
Chile3472 Posts
May 28 2009 01:01 GMT
#12
HOE I have a suggestion to make life easier to you:
Identation: helps to find easily where your code blocks belong, I hate to see a code that ends in 3/4 brackets and I dont know where the fuck they belong.

Help me! im still improving my English. An eye for an eye makes the whole world blind. M. G.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:02 GMT
#13
i'll post in a sec (at the bullshit)
"come korea next time... FXO house... 10 korean, 10 korean"
Abydos1
Profile Blog Joined October 2008
United States832 Posts
May 28 2009 01:02 GMT
#14
On May 28 2009 10:01 Malongo wrote:
HOE I have a suggestion to make life easier to you:
Identation: helps to find easily where your code blocks belong, I hate to see a code that ends in 3/4 brackets and I dont know where the fuck they belong.



fyi, it is indented but quote doesn't show them correctly.
"...perhaps the greatest joy possible in Starcraft, being accused of being a maphacker" - Day[9]
Malongo
Profile Blog Joined November 2005
Chile3472 Posts
May 28 2009 01:06 GMT
#15
On May 28 2009 10:02 Abydos1 wrote:
Show nested quote +
On May 28 2009 10:01 Malongo wrote:
HOE I have a suggestion to make life easier to you:
Identation: helps to find easily where your code blocks belong, I hate to see a code that ends in 3/4 brackets and I dont know where the fuck they belong.



fyi, it is indented but quote doesn't show them correctly.

Lollol true.
Help me! im still improving my English. An eye for an eye makes the whole world blind. M. G.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:12 GMT
#16
On May 28 2009 09:53 Abydos1 wrote:
Show nested quote +
On May 28 2009 09:28 HeavOnEarth wrote:

import java.util.Scanner;

public class UserInput{

public UserInput(){

try{
String done = "DONE";
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
/**
* Here is the problem, it is ending the process,
* when it is obviously catching the exception.
*/
throw new StringTooLongException();
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}
}



If you're talking about this one the exception keeps going up the stack until it gets caught or the program ends, thus its getting out of the while loop.


Thank you for actually knowing what you're talking about. I will look into this, after I rape some BM'ing assholes below.
-------------------
On May 28 2009 09:54 RaGe wrote:
Maybe you should stop being so defensive and read the fucking solution for a change.

Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code



Your catch block is outside of the while loop, so it doesn't continue in the while loop after it executes the catch block. Java does not magically read your mind. This wasn't supposed to work. This isn't some obscure error. This is you skipping through whatever 'How to handle exceptions' guide you read, copy pasting some stupid shit that you don't understand, and asking tl to fix your errors.


Maybe you should learn Java before you post. You can't put catch statement inside a try statement. Idiot.

On May 28 2009 09:55 qrs wrote:
^yes, but your catch block is outside the while loop. It's the same as if you would have used goto in C.
edit: Rage pre-empted me

Same to you, cept I'm going to be nice about it. A catch can't go inside a try statement.
-------------------
On May 28 2009 09:55 Malongo wrote:
I dont understand this program does exaclty what you want imo. LOL.

On May 28 2009 09:56 Malongo wrote:
Show nested quote +
On May 28 2009 09:49 HeavOnEarth wrote:
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)

Catch is outside the loop... -_-


It does what it fucking does, and I don't understand why it's ending instead of continuing.
And again, catch can't go inside a try.

On May 28 2009 10:01 Malongo wrote:
HOE I have a suggestion to make life easier to you:
Identation: helps to find easily where your code blocks belong, I hate to see a code that ends in 3/4 brackets and I dont know where the fuck they belong.


Die. Please.
"come korea next time... FXO house... 10 korean, 10 korean"
qrs
Profile Blog Joined December 2007
United States3637 Posts
Last Edited: 2009-05-28 01:17:54
May 28 2009 01:17 GMT
#17
Dude, no one is saying that the catch should go inside the try. If you want the while loop to continue, then the catch should go inside the while loop. Why don't you read what people write? Try is not a loop.
'As per the American Heart Association, the beat of the Bee Gees song "Stayin' Alive" provides an ideal rhythm in terms of beats per minute to use for hands-only CPR. One can also hum Queen's "Another One Bites The Dust".' —Wikipedia
aers *
Profile Joined January 2009
United States1210 Posts
May 28 2009 01:17 GMT
#18
Put the try inside the while loop.
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 01:19 GMT
#19
Stop being so aggressive to the suggestions here. Also please stop martyring yourself.

People are giving you good advice and your reaction to it is terrible.
Moderator
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 01:20 GMT
#20
First of all: Tell me where I tell you to put your catch block inside your try block? Right, no where. You're the one that doesn't know where to put it, not me.

Secondly: Don't tell me to go learn some Java when you're learning the basic shit yourself and don't even realize how retarded all your previous statements were.

Lastly: Can you please tell me who the fuck you're sharing your account with that is making these dumbass statements? Apparently your IP has been static for days, and now it changes for every post you make about this problem.

Abusing your forum regular status to get answers for a friend that's apparently retarded. Way to fucking go.
Moderatorsometimes I get intimidated by the size of my right testicle
qrs
Profile Blog Joined December 2007
United States3637 Posts
May 28 2009 01:22 GMT
#21
On May 28 2009 10:20 RaGe wrote:
Lastly: Can you please tell me who the fuck you're sharing your account with that is making these dumbass statements? Apparently your IP has been static for days, and now it changes for every post you make about this problem.

Aha! Clever, RaGe.
'As per the American Heart Association, the beat of the Bee Gees song "Stayin' Alive" provides an ideal rhythm in terms of beats per minute to use for hands-only CPR. One can also hum Queen's "Another One Bites The Dust".' —Wikipedia
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:22 GMT
#22
We're both working on the same thing, =/.
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:23 GMT
#23
I don't see how that's even relevant anyways?
"come korea next time... FXO house... 10 korean, 10 korean"
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
May 28 2009 01:25 GMT
#24
everything has been answered for you

stop acting like a douche yo
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
imDerek
Profile Blog Joined August 2007
United States1944 Posts
May 28 2009 01:25 GMT
#25
try-catch-finally
Least favorite progamers: Leta, Zero, Mind, Shine, free, really <-- newly added
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 01:26 GMT
#26
You don't see why letting people log onto your account, using your veteran status to get answers, and then posting ridiculous flames is relevant?
Moderator
Divinek
Profile Blog Joined November 2006
Canada4045 Posts
May 28 2009 01:35 GMT
#27
You sure raped those bm'ing assholes but not actually reading their posts then replying!
Never attribute to malice that which can be adequately explained by stupidity.
Oh goodness me, FOX tv where do you get your sight? Can't you keep track, the puck is black. That's why the ice is white.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:38 GMT
#28
by courtesy of chill
http://www.teamliquid.net/staff/Chill/heav.png
lmfao
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:44 GMT
#29
import java.util.Scanner;
public class UserInput{

public String done= "DONE";;
public Scanner scan = new Scanner(System.in);
public String scanned = "";

public UserInput(){

System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
while(scanned.compareTo(done) != 0){
try{
scanned = scan.next();
if(scanned.length() > 20){
throw new StringTooLongException();
}
System.out.println(scanned);
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Continuing...");
}
}
}

}

Woot. Fixed! Learn English guys. Jesus christ. If you meant to put the ENTIRE TRYCATCH inside the while loop, then that'd have been nice. w00t@Abysdos being helpful, printStackTrace actually made me compare the two programs I had, and whee.
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:46 GMT
#30
Hay RaGe why so cry to Nam instead of to me?
"come korea next time... FXO house... 10 korean, 10 korean"
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
May 28 2009 01:46 GMT
#31
no

obviously we meant put the try statement both inside and outside the while loop, and the catch statement should be in another program altogether.

HOW COULD WE BE SO UNCLEAR!
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
May 28 2009 01:47 GMT
#32
I mean dear god

try and catch in the same scope

WHAT ARE YOU TRYING TO DO TO ME
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
Last Edited: 2009-05-28 01:53:36
May 28 2009 01:51 GMT
#33
On May 28 2009 10:46 HeavOnEarth wrote:
Hay RaGe why so cry to Nam instead of to me?

Cause if you still don't understand what I wrote, you still don't understand how it works.

See you back when your next homework is due, cause I don't see you comprehending anything anytime soon.

edit: I mean, looking back, do you understand why your previous code didn't work? Why you needed to change the location of your try and catch blocks?

The mistake you made was assuming when an exception is thrown, after the catch block is executed, it resumes in the try block (which would completely ruin the function of try-catch blocks btw). I corrected that by literally saying it resumes after the catch block.
Moderatorsometimes I get intimidated by the size of my right testicle
nataziel
Profile Blog Joined October 2008
Australia1455 Posts
May 28 2009 01:52 GMT
#34
-_- = This whole thread
u gotta sk8
mahnini
Profile Blog Joined October 2005
United States6862 Posts
May 28 2009 01:52 GMT
#35
this is a terrible homework thread

1. code is unreadable
2. OP is stupid
3. OP doesnt know he's stupid
the world's a playground. you know that when you're a kid, but somewhere along the way everyone forgets it.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:54 GMT
#36
My friend's SFSkabam then.
"come korea next time... FXO house... 10 korean, 10 korean"
azndsh
Profile Blog Joined August 2006
United States4447 Posts
May 28 2009 01:55 GMT
#37
wait... how the hell is this NOT homework?
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
May 28 2009 01:57 GMT
#38
it is, hence them both working on the same thing. He just figures if he lies about it he can keep his thread open
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 01:58 GMT
#39
He lives in Oregon i live in Texas
This is totally classwork for college. you got me man.
"come korea next time... FXO house... 10 korean, 10 korean"
SFSKabam
Profile Joined May 2009
United States1 Post
May 28 2009 01:59 GMT
#40
On May 28 2009 10:47 fusionsdf wrote:
I mean dear god

try and catch in the same scope

WHAT ARE YOU TRYING TO DO TO ME

On May 28 2009 10:46 fusionsdf wrote:
no

obviously we meant put the try statement both inside and outside the while loop, and the catch statement should be in another program altogether.

HOW COULD WE BE SO UNCLEAR!

I know right? Jesus, if only everyone ALREADY knew Java! Then I wouldn't need to politely ask a fucking question, and have some piece of shit named RaGe basically passive flame me with bullshit statement such as "LAWL YOURNUB LERN 2 KNOW JAVA, WHY ASK QUESTION LOL YOU HAS PRINT LINE OHNOES."

On May 28 2009 10:51 RaGe wrote:
Show nested quote +
On May 28 2009 10:46 HeavOnEarth wrote:
Hay RaGe why so cry to Nam instead of to me?

Cause if you still don't understand what I wrote, you still don't understand how it works.

See you back when your next homework is due, cause I don't see you comprehending anything anytime soon.

Actually, this's the first problem I've had big enough problem to fucking post online. Probably not the last, but certainly the last for a long time.

On May 28 2009 10:52 mahnini wrote:
this is a terrible homework thread

1. code is unreadable
2. OP is stupid
3. OP doesnt know he's stupid


1: Code is perfeclty indented, TL.net is just pathetic and doesn't know what a "tab" space is?
2: Rofl
3: Rofl these don't even deserve a comment.

On May 28 2009 10:51 RaGe wrote:
edit: I mean, looking back, do you understand why your previous code didn't work? Why you needed to change the location of your try and catch blocks?

The mistake you made was assuming when an exception is thrown, after the catch block is executed, it resumes in the try block (which would completely ruin the function of try-catch blocks btw). I corrected that by literally saying it resumes after the catch block.

JESUS CHRIST, THAT'S EXACTLY WHAT I ASKED AT THE TOP?

ME:
Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

Notice how I said "I'm wondering why ..." ? The first time I put trycatch inside a while loop I got a fucking runtime error in Eclipse.

ALSO IT'S NOT FUCKING HOMEWORK. IT'S HELP IN UNDERSTANDING. Fuck off.
TL.Net fails. lawl.
fusionsdf
Profile Blog Joined June 2006
Canada15390 Posts
May 28 2009 02:01 GMT
#41
On May 28 2009 09:54 RaGe wrote:
Maybe you should stop being so defensive and read the fucking solution for a change.

Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code



Your catch block is outside of the while loop, so it doesn't continue in the while loop after it executes the catch block. Java does not magically read your mind. This wasn't supposed to work. This isn't some obscure error. This is you skipping through whatever 'How to handle exceptions' guide you read, copy pasting some stupid shit that you don't understand, and asking tl to fix your errors.



seems like he answered the question pretty obviously to me
SKT_Best: "I actually chose Protoss because it was so hard for me to defeat Protoss as a Terran. When I first started Brood War, my main race was Terran."
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:02 GMT
#42
.. so RaGe agrees , to argue with SFSkabam .. and you ban him before RaGe even replies?
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:03 GMT
#43
o noz lets not even address any points of his new post and just ban him
"come korea next time... FXO house... 10 korean, 10 korean"
mahnini
Profile Blog Joined October 2005
United States6862 Posts
May 28 2009 02:03 GMT
#44
i dunno maybe you should take the time to properly indent the code if you want people to take the time to read it. might want to give it some white space too
the world's a playground. you know that when you're a kid, but somewhere along the way everyone forgets it.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:04 GMT
#45
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell
"come korea next time... FXO house... 10 korean, 10 korean"
aers *
Profile Joined January 2009
United States1210 Posts
May 28 2009 02:04 GMT
#46
it should be throwing an error, catching it, and then going back to the while loop.


Your problem is this is wrong. That's not how try/catch loops work. That is exactly what RaGe pointed out in his first post.

1) try <something>
2) throw exception
3) catch exception
4) execution continues after try/catch block
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 02:04 GMT
#47
His first post was talking shit to a moderator, so yes, I ban him.
His "real" first post was showing no humility and talking shit to people trying to help him.
Moderator
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:05 GMT
#48
On May 28 2009 11:03 mahnini wrote:
i dunno maybe you should take the time to properly indent the code if you want people to take the time to read it. might want to give it some white space too

can we drop this
read the thread before you post
here it is for you
On May 28 2009 10:02 Abydos1 wrote:
Show nested quote +
On May 28 2009 10:01 Malongo wrote:
HOE I have a suggestion to make life easier to you:
Identation: helps to find easily where your code blocks belong, I hate to see a code that ends in 3/4 brackets and I dont know where the fuck they belong.



fyi, it is indented but quote doesn't show them correctly.

"come korea next time... FXO house... 10 korean, 10 korean"
Elemenope
Profile Blog Joined March 2006
Burkina Faso1704 Posts
May 28 2009 02:06 GMT
#49
On May 28 2009 11:04 HeavOnEarth wrote:
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell



On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol




Yeah man, that was quite posting shit, much unprovoked as far as I can tell too.
In DotA you could
Abydos1
Profile Blog Joined October 2008
United States832 Posts
May 28 2009 02:07 GMT
#50
http://lmgtfy.com/?q=java exceptions&l=1

Learn to do some basic searching first...
"...perhaps the greatest joy possible in Starcraft, being accused of being a maphacker" - Day[9]
mahnini
Profile Blog Joined October 2005
United States6862 Posts
Last Edited: 2009-05-28 02:08:28
May 28 2009 02:07 GMT
#51
[ indent ]

makes it 10x easier to read and shows some effort at least. anyway, doesnt really matter cause people sifter through the code anyway and told him what was wrong and he spazzed out.
the world's a playground. you know that when you're a kid, but somewhere along the way everyone forgets it.
So no fek
Profile Blog Joined June 2005
United States3001 Posts
May 28 2009 02:07 GMT
#52
On May 28 2009 11:06 Elemenope wrote:
Show nested quote +
On May 28 2009 11:04 HeavOnEarth wrote:
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell



Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol




Yeah man, that was quite posting shit, much unprovoked as far as I can tell too.


I'd assume he's talking about Rage's second post, which is a small bit on the offense, however, the way the OP handled it from there... /facepalm
#1 Shuttle fan - TeamLiquid CJ Entusman #36 BW4lyfe
ThaddeusK
Profile Joined July 2008
United States231 Posts
May 28 2009 02:07 GMT
#53
rage's first post answered the OP perfectly, shouldve just been closed after it >.>
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
Last Edited: 2009-05-28 02:09:30
May 28 2009 02:08 GMT
#54
Yes I agree Rage escillated it unprovoked. But it's pretty obvious that:
1) You martyr yourself in the first post (slap to moderators' face).
2) It's obviously homework.
3) You don't know what you're doing.

Had you approached with humility and addressed the above three points, we wouldn't be in this situation. Yes, Rage should have been more forgiving and not attacked you/your friend, but after being clearly proven wrong your friend degraded into just insulting everyone. That doesn't fly here.
Moderator
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:08 GMT
#55
On May 28 2009 11:06 Elemenope wrote:
Show nested quote +
On May 28 2009 11:04 HeavOnEarth wrote:
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell



Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol




Yeah man, that was quite posting shit, much unprovoked as far as I can tell too.


wow i get more and more convinced you have no idea what you're doing and just copy pasted shit

it's not copy pasted?
at this point he's insulting me as well ; not just my friend

IN response to this
On May 28 2009 09:49 HeavOnEarth wrote:
Show nested quote +
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

Show nested quote +
On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)


Rage posts
Maybe you should stop being so defensive and read the fucking solution for a change.

"come korea next time... FXO house... 10 korean, 10 korean"
wesbrown
Profile Joined March 2008
United States31 Posts
Last Edited: 2009-05-28 02:12:36
May 28 2009 02:09 GMT
#56
If you're only using the try/catch block to look for StringTooLongExceptions before printing the input string, you can do this without obfuscating the code by using continue.



+ Show Spoiler +

import java.util.Scanner;
public class UserInput{

public String done= "DONE";;
public Scanner scan = new Scanner(System.in);
public String scanned = "";

public UserInput(){

System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
while(scanned.compareTo(done) != 0){
try{
scanned = scan.next();
if(scanned.length() > 20){
throw new StringTooLongException();
}
System.out.println(scanned);
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Continuing...");
}
}
}

}


becomes

+ Show Spoiler +

import java.util.Scanner;
public class UserInput{

public String done= "DONE";;
public Scanner scan = new Scanner(System.in);
public String scanned = "";

public UserInput(){

System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
while(scanned.compareTo(done) != 0){
scanned = scan.next();
if(scanned.length() > 20){
System.out.println("Input String was too long.");
continue;
}
System.out.println(scanned);
}
}

}



Note that I'm not familiar with the Scanner class, but it doesn't look like it should throw exceptions based on your code. Given that, there is no reason to use a try/catch block.

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/branch.html
ChillIsPathetic
Profile Joined May 2009
1 Post
May 28 2009 02:10 GMT
#57
Chill you're naught but a pathetic power hungry 13 year old? I like how I get BM'd first, and I'm the bad guy. Rofl.
Seriously, almost the entire TL.net community is fucking trash, including the mods. Seriously, why was Kawaii so pissed about this pathetic site.

Lawl, banned:
Reason: Incosiderate newb. Try harder on your next account.

There will be no more accounts (other than this one)? This site was trash the first time I used it, and it was again, even on Nam's account when I was extremely fucking GM. First some pathetic piece of shit mod closes the first thread, and then I get lawl'd by RaGe, who gains a fuckton of retards behind him? Seriously, you people need to burn at the stake.
Rof. This site is trash, and so are the mods apparently?
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:10 GMT
#58
On May 28 2009 11:08 Chill wrote:
Yes I agree Rage escillated it unprovoked. But it's pretty obvious that:
1) You martyr yourself in the first post (slap to moderators' face).
2) It's obviously homework.
3) You don't know what you're doing.

Had you approached with humility and avoided the above three points, we wouldn't be in this situation. Yes, Rage should have been more forgiving and not attacked you/your friend, but after being clearly proven wrong your friend degrading into just insulting everyone. That doesn't fly here.

3)He didn't even have a chance to explain what he understands and RaGe shits all over him on it?

2)How is trying to understand something homework- we already posted the code, hell we fixed it as well.
"come korea next time... FXO house... 10 korean, 10 korean"
Abydos1
Profile Blog Joined October 2008
United States832 Posts
May 28 2009 02:10 GMT
#59
Indenting (and syntax highlighting) since TL doesn't do it...

http://pastebin.com/m6e7a70d8
"...perhaps the greatest joy possible in Starcraft, being accused of being a maphacker" - Day[9]
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 02:11 GMT
#60
On May 28 2009 11:08 HeavOnEarth wrote:
Show nested quote +
On May 28 2009 11:06 Elemenope wrote:
On May 28 2009 11:04 HeavOnEarth wrote:
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell



On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol




Yeah man, that was quite posting shit, much unprovoked as far as I can tell too.

Show nested quote +

wow i get more and more convinced you have no idea what you're doing and just copy pasted shit

it's not copy pasted?
at this point he's insulting me as well ; not just my friend

IN response to this
Show nested quote +
On May 28 2009 09:49 HeavOnEarth wrote:
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)

Show nested quote +

Rage posts
Maybe you should stop being so defensive and read the fucking solution for a change.


I can't even program and I understand what Rage says. Exception thrown = goto catch. Your friend doesn't address this point at all. So Rage says l2read.
Moderator
aers *
Profile Joined January 2009
United States1210 Posts
May 28 2009 02:11 GMT
#61
Yeah, I told him in IRC that using an exception is excessive there. It's a simple while loop that takes input and prints it back out.
mahnini
Profile Blog Joined October 2005
United States6862 Posts
May 28 2009 02:11 GMT
#62
lol
the world's a playground. you know that when you're a kid, but somewhere along the way everyone forgets it.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:12 GMT
#63
On May 28 2009 11:10 ChillIsPathetic wrote:
Chill you're naught but a pathetic power hungry 13 year old? I like how I get BM'd first, and I'm the bad guy. Rofl.
Seriously, almost the entire TL.net community is fucking trash, including the mods. Seriously, why was Kawaii so pissed about this pathetic site.

Lawl, banned:
Reason: Incosiderate newb. Try harder on your next account.

There will be no more accounts (other than this one)? This site was trash the first time I used it, and it was again, even on Nam's account when I was extremely fucking GM. First some pathetic piece of shit mod closes the first thread, and then I get lawl'd by RaGe, who gains a fuckton of retards behind him? Seriously, you people need to burn at the stake.

Uh if i agree do i get banned too?
The bandwagon was pathetic, RaGe flaming first was uncalled for, and the only one who probably helped was Abydos1

On May 28 2009 09:53 Abydos1 wrote:
Show nested quote +
On May 28 2009 09:28 HeavOnEarth wrote:

import java.util.Scanner;

public class UserInput{

public UserInput(){

try{
String done = "DONE";
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
/**
* Here is the problem, it is ending the process,
* when it is obviously catching the exception.
*/
throw new StringTooLongException();
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}
}



If you're talking about this one the exception keeps going up the stack until it gets caught or the program ends, thus its getting out of the while loop.

"come korea next time... FXO house... 10 korean, 10 korean"
Rostam
Profile Blog Joined December 2008
United States2552 Posts
May 28 2009 02:12 GMT
#64
On May 28 2009 11:10 ChillIsPathetic wrote:
Chill you're naught but a pathetic power hungry 13 year old? I like how I get BM'd first, and I'm the bad guy. Rofl.
Seriously, almost the entire TL.net community is fucking trash, including the mods. Seriously, why was Kawaii so pissed about this pathetic site.

Lawl, banned:
Reason: Incosiderate newb. Try harder on your next account.

There will be no more accounts (other than this one)? This site was trash the first time I used it, and it was again, even on Nam's account when I was extremely fucking GM. First some pathetic piece of shit mod closes the first thread, and then I get lawl'd by RaGe, who gains a fuckton of retards behind him? Seriously, you people need to burn at the stake.


Hey man, they just did your homework for you! You should be grateful.
BW forever || Thall
aers *
Profile Joined January 2009
United States1210 Posts
May 28 2009 02:13 GMT
#65
... I give up.
mahnini
Profile Blog Joined October 2005
United States6862 Posts
May 28 2009 02:14 GMT
#66
On May 28 2009 11:10 Abydos1 wrote:
Indenting (and syntax highlighting) since TL doesn't do it...

http://pastebin.com/m6e7a70d8

ROFL
the world's a playground. you know that when you're a kid, but somewhere along the way everyone forgets it.
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:16 GMT
#67
On May 28 2009 11:10 Abydos1 wrote:
Indenting (and syntax highlighting) since TL doesn't do it...

http://pastebin.com/m6e7a70d8

Thank you.
"come korea next time... FXO house... 10 korean, 10 korean"
nataziel
Profile Blog Joined October 2008
Australia1455 Posts
May 28 2009 02:16 GMT
#68
Did I see a thread title change then quick revert?
u gotta sk8
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 02:16 GMT
#69
On May 28 2009 11:12 HeavOnEarth wrote:
Show nested quote +
On May 28 2009 11:10 ChillIsPathetic wrote:
Chill you're naught but a pathetic power hungry 13 year old? I like how I get BM'd first, and I'm the bad guy. Rofl.
Seriously, almost the entire TL.net community is fucking trash, including the mods. Seriously, why was Kawaii so pissed about this pathetic site.

Lawl, banned:
Reason: Incosiderate newb. Try harder on your next account.

There will be no more accounts (other than this one)? This site was trash the first time I used it, and it was again, even on Nam's account when I was extremely fucking GM. First some pathetic piece of shit mod closes the first thread, and then I get lawl'd by RaGe, who gains a fuckton of retards behind him? Seriously, you people need to burn at the stake.

Uh if i agree do i get banned too?
The bandwagon was pathetic, RaGe flaming first was uncalled for, and the only one who probably helped was Abydos1

Show nested quote +
On May 28 2009 09:53 Abydos1 wrote:
On May 28 2009 09:28 HeavOnEarth wrote:

import java.util.Scanner;

public class UserInput{

public UserInput(){

try{
String done = "DONE";
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
/**
* Here is the problem, it is ending the process,
* when it is obviously catching the exception.
*/
throw new StringTooLongException();
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}
}



If you're talking about this one the exception keeps going up the stack until it gets caught or the program ends, thus its getting out of the while loop.


Stop fucking martyring yourself. No one gets banned for have rational discussion about moderators.

Rage attacked unprovoked when he shouldn't have; I've already admitted that. However, your friend is much more at fault in this case. And being that he has literally nothing to add and if flaming many people, he is banned.
Moderator
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 02:17 GMT
#70
Rage's first post is literally everything you need to know. "Didn't help"? If you mean he didn't post the updated code, then sure, but he posted the reason your code wasn't doing what you expected, and everyone can clearly understand it.
Moderator
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:17 GMT
#71
On May 28 2009 11:11 Chill wrote:
Show nested quote +
On May 28 2009 11:08 HeavOnEarth wrote:
On May 28 2009 11:06 Elemenope wrote:
On May 28 2009 11:04 HeavOnEarth wrote:
I mean jesus christ, have you read the begginning of the thread? RaGe started posting shit , pretty much unprovoked as far as i can tell



On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol




Yeah man, that was quite posting shit, much unprovoked as far as I can tell too.


wow i get more and more convinced you have no idea what you're doing and just copy pasted shit

it's not copy pasted?
at this point he's insulting me as well ; not just my friend

IN response to this
On May 28 2009 09:49 HeavOnEarth wrote:
On May 28 2009 09:38 RaGe wrote:
When an exception gets thrown, it immeadiately skips to the Catch, which is at the end of your program, so it terminates the program cause there's no following lines of code

program is doing what you made it to do lol


Firstly, the throw is inside a while loop. What I'm wondering is why the crap it isn't continuing the while loop, opposed to what it does now; which is ends the program. It should not be ending the program, it should be throwing an error, catching it, and then going back to the while loop.

On May 28 2009 09:44 RaGe wrote:
wow i get more and more convinced you have no idea what you're doing and just copy pasted shit or something

i mean, your catch block is:

catch(StringTooLongException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}


you even print that you're ending the program and you dont want it to end the program?


Oh noes, I has a random print line that hasn't been changed from a previous version. Printing text doesn't end a program. ... (At least not this one)


Rage posts
Maybe you should stop being so defensive and read the fucking solution for a change.


I can't even program and I understand what Rage says. Exception thrown = goto catch. Your friend doesn't address this point at all. So Rage says l2read.


That's nice, Chill. Nowhere was it explained that it doesn't go back to where the throw was. Which is the exact fucking opposite of what my "Teacher" had told / shown us inside a fucking powerpoint presentation.
"come korea next time... FXO house... 10 korean, 10 korean"
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 02:18 GMT
#72
If you stopped lying and admitted that you're not working with him on his 'project' and that you have no clue about Java, you would understand that he just copy pasted that entire catch block in to an arbitrary point in his code and was wondering why it didn't work. The reason why my second reply stated this in a little hostile manner is because after your first thread getting closed, you repost it with a question about he a subject that was clearly not even studied. If he read a basic guide on Exceptions, he would've known what I posted in my first solution.

So, what he basically did was:

1. Copy paste code without understanding how it worked.
2. Being puzzled at why it doesn't work, he posted a thread asking for the fix instead of asking for an explanation.
3. Gets his thread closed. Still doesn't think he should actually try researching what he's doing, and reposts in an aggressive way.

I still post the right answer. Then I realize all this and get a little frustrated and post this:

wow i get more and more convinced you have no idea what you're doing and just copy pasted shit


What he does?

4. Denies my completely valid explanation.
5. Starts flaming people.

How can you even defend this?
Moderatorsometimes I get intimidated by the size of my right testicle
Xeofreestyler
Profile Blog Joined June 2005
Belgium6771 Posts
May 28 2009 02:25 GMT
#73
lmao Heavonearth your friend is one frustrated piece of shit

bringing up kawaii's opinion is the cherry though
Graphics
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:27 GMT
#74

public class Starter {

public static void main(String[] args) {

String done = "DONE";
System.out.println("DocType? U = Unclassified, C = Confidential, P = Proprietary.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String docType = scan.next();
while(docType.compareTo(done) != 0){
Document doc = new Document(docType);
System.out.println(doc);
docType = scan.next();
}
System.out.println("Program Fin~");
}

}

public class InvalidDocumentCodeException extends Exception{

public InvalidDocumentCodeException(){
}

public String getMessage(){
return "Document code must be U (Unclassified), C (Confidential), or P (Proptietary)." +
"\nDocument will default to Unclassified.";
}

}

public class Document {

private String dType = "U";
public Document(String docType){
try{
if( docType.compareToIgnoreCase("U") != 0
&& docType.compareToIgnoreCase("C") != 0
&& docType.compareToIgnoreCase("P") != 0 )
throw new InvalidDocumentCodeException();
dType = docType;
}
catch(InvalidDocumentCodeException e){
System.out.println("Exception caught and handled! Continuing...");
System.out.println(e.getMessage());
}
}

public void setDocType(String docType){
dType = docType;
}
public String toString(){
return "Document type: "+ dType.toUpperCase();
}
}

i bet i copied pasted all this shit too right?
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:28 GMT
#75
here's another one..

/**
* @param args
*/
public static void main(String[] args) {
try{
String done = "DONE";
System.out.println("DocType? U = Unclassified, C = Confidential, P = Proprietary.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String docType = scan.next();
while(docType.compareTo(done) != 0){
if( docType.compareToIgnoreCase("U") != 0
&& docType.compareToIgnoreCase("C") != 0
&& docType.compareToIgnoreCase("P") != 0 )
throw new InvalidDocumentCodeException();
Document doc = new Document(docType);
System.out.println(doc);
docType = scan.next();
}
System.out.println("Program Fin~");
}
catch(InvalidDocumentCodeException e){
System.out.println(e.getMessage());
System.out.println("Exception caught! Ending program.");
}
}

}

public class InvalidDocumentCodeException extends Exception{

public InvalidDocumentCodeException(){
}

public String getMessage(){
return "Document code must be U (Unclassified), C (Confidential), or P (Proptietary).";
}

}

public class Document {

private String dType;
public Document(String docType){
try{
if( docType.compareToIgnoreCase("U") != 0
&& docType.compareToIgnoreCase("C") != 0
&& docType.compareToIgnoreCase("P") != 0 )
throw new InvalidDocumentCodeException();
dType = docType;
}
catch(InvalidDocumentCodeException e){
System.out.println("Exception caught!");
System.out.println(e.getMessage());
}
}

public String toString(){
return "Document type: "+ dType.toUpperCase();
}
}
"come korea next time... FXO house... 10 korean, 10 korean"
HeavOnEarth
Profile Blog Joined March 2008
United States7087 Posts
May 28 2009 02:28 GMT
#76
and i obviously , obviously copied pasted this as well

/**
* @param args
*/
public static void main(String[] args) throws StringTooLongException{

try{
String done = "DONE";
StringTooLongException e;
System.out.println("Type a string. Max 20 characters.");
System.out.println("Type DONE, in all caps to end.");
Scanner scan = new Scanner(System.in);
String s = scan.next();
while(s.compareTo(done) != 0){
if(s.length() > 20){
e = new StringTooLongException();
throw e;
}
System.out.println(s);
s = scan.next();
}
}
catch(StringTooLongException e){
System.out.println("Exception caught! Ending program!");
}

}

}

public class StringTooLongException extends Exception{

StringTooLongException(){
System.out.println("String is greater than 20 characters.");
}

}
"come korea next time... FXO house... 10 korean, 10 korean"
Chill
Profile Blog Joined January 2005
Calgary25980 Posts
May 28 2009 02:30 GMT
#77
Ok. Closing this shit.
Moderator
RaGe
Profile Blog Joined July 2004
Belgium9947 Posts
May 28 2009 02:40 GMT
#78
Rofl, he even admitted to copy pasting in the end.
Moderatorsometimes I get intimidated by the size of my right testicle
Manifesto7
Profile Blog Joined November 2002
Osaka27148 Posts
May 28 2009 06:40 GMT
#79
This whole thread is just wow.
ModeratorGodfather
zatic
Profile Blog Joined September 2007
Zurich15325 Posts
May 28 2009 08:35 GMT
#80
WTF happened here....
ModeratorI know Teamliquid is known as a massive building
Plexa
Profile Blog Joined October 2005
Aotearoa39261 Posts
May 28 2009 11:01 GMT
#81
... TL never ceases to surprise me
Administrator~ Spirit will set you free ~
Normal
Please log in or register to reply.
Live Events Refresh
RotterdaM Event
17:00
$100 Stream Ruble
RotterdaM771
Liquipedia
CSO Contender
17:00
#43
Liquipedia
PSISTORM Gaming Misc
15:55
FSL Team League: PTB vs RR
Liquipedia
Epic.LAN
12:00
Epic.LAN 45 Playoffs Stage
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 771
BRAT_OK 110
JuggernautJason46
StarCraft: Brood War
Mini 1056
Larva 578
firebathero 201
ZZZero.O 122
TY 119
Aegong 74
yabsab 17
GoRush 14
Stormgate
TKL 130
Dota 2
qojqva3811
monkeys_forever344
League of Legends
Grubby3875
Counter-Strike
fl0m2489
Stewie2K868
Heroes of the Storm
Liquid`Hasu302
Other Games
Beastyqt607
Trikslyr252
Hui .197
Skadoodle166
KnowMe114
ArmadaUGS113
ToD99
Sick59
Organizations
Other Games
gamesdonequick2159
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• printf 65
• tFFMrPink 16
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• blackmanpl 18
• HerbMon 15
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21672
League of Legends
• Nemesis6063
Other Games
• imaqtpie1673
• WagamamaTV200
Upcoming Events
Sparkling Tuna Cup
14h 38m
Online Event
20h 38m
Esports World Cup
2 days
ByuN vs Astrea
Lambo vs HeRoMaRinE
Clem vs TBD
Solar vs Zoun
SHIN vs Reynor
Maru vs TriGGeR
herO vs Lancer
Cure vs ShoWTimE
Esports World Cup
3 days
Esports World Cup
4 days
Esports World Cup
5 days
CranKy Ducklings
6 days
BSL20 Non-Korean Champi…
6 days
BSL20 Non-Korean Champi…
6 days
Bonyth vs Sziky
Dewalt vs Hawk
Hawk vs QiaoGege
Sziky vs Dewalt
Mihu vs Bonyth
Zhanhun vs QiaoGege
QiaoGege vs Fengzi
Liquipedia Results

Completed

CSL Xiamen Invitational: ShowMatche
RSL Revival: Season 1
Murky Cup #2

Ongoing

BSL 2v2 Season 3
Copa Latinoamericana 4
Jiahua Invitational
BSL20 Non-Korean Championship
CSL Xiamen Invitational
2025 ACS Season 2
Championship of Russia 2025
Underdog Cup #2
FISSURE Playground #1
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25

Upcoming

CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
BSL Season 21
RSL Revival: Season 2
SEL Season 2 Championship
uThermal 2v2 Main Event
FEL Cracov 2025
Esports World Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.