Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
almostkorean
Jul 9, 2001
eeeeeeeee

Aleksei Vasiliev posted:

you can't override a field and it should be causing a compile error*

as for how to do it properly, I can't help

*: if you put @Override above it. you are doing that, right? because overriding without putting @Override is dumb and bad

Right, I'm not using @Override since you can't use it on a field. I made a field called 'locations' in the sub-class, and assigned it to a new array that only contains north and south locations thinking that it would use the sub-class's instance of the locations field when it draws the border. The draw border function is the code I posted above (and is defined in the super class which has its own 'locations' field)

When I step through the function with a debugger, it shows two 'locations' fields like this:

Which seems weird to me. I feel like it either shouldn't allow me to make a field in the subclass with the same name(like you said) or it should only have the subclass's instance of 'locations'.

Outlaw Programmer posted:

When you declare a field as 'private', even subclasses don't have access to them. You can either mark this field as 'protected' and just reassign it in your subclass, or create an accessor like 'getLocations()' that you can override.

That being said, I'm not sure I would go with inheritance in this particular case. Why not just have a boolean to draw all or draw only north/south?

The field isn't 'private' but for some reason reassigning it doesn't work. I'll try the accessor method, thanks for the advice.

Adbot
ADBOT LOVES YOU

Max Facetime
Apr 18, 2009

almostkorean posted:


Which seems weird to me. I feel like it either shouldn't allow me to make a field in the subclass with the same name(like you said) or it should only have the subclass's instance of 'locations'.

Having two fields named the same is not disallowed but it's not good style.

It looks like you're using Eclipse. Go to Window->Preferences->Java->Compiler->Errors/Warnings->Name shadowing and conflicts->Field declaration hides another field or variable and set it to Warning. In fact you can set most of those to Warning.

Max Facetime fucked around with this message at 00:38 on Mar 29, 2011

Contra Duck
Nov 4, 2004

#1 DAD
e: let's try this again!


You're really using inheritance in the wrong way here. The fact that you have this weird scenario with multiple locations lists should tip you off to that. If you must use inheritance for this problem I would suggest changing your model so that you have an abstract superclass that deals with an arbitrary list of points and then make the 2 and 8 point versions inherit from that. Something like:

code:
public abstract class AbstractBorder {

    public abstract Location[] getLocations();

    public void paintBorder(Component component, Graphics g, int x, int y, int w, int h) {
        ...
        for (int i = 0; i < [i]getLocations()[/i].length; i++) {
            ...
        }
    }
}

public class BorderWithEightPoints extends AbstractBorder {

    private Location[] locations;

    public BorderWithEightPoints() {
        /* some code that fills in the locations array with 8 elements */
    }

    @Override
    public Location[] getLocations() {
        return locations;
    }
}

public class BorderWithTwoPoints extends AbstractBorder {

    private Location[] locations;

    public BorderWithTwoPoints() {
        /* some code that fills in the locations array with 2 elements */
    }

    @Override
    public Location[] getLocations() {
        return locations;
    }
}
Personally though I wouldn't be using inheritance at all since these two classes really seems to have the same data model and functionality. I'd create one class that does everything for dealing with a locations list of arbitrary length and then just populate the locations list differently in each instance.

Contra Duck fucked around with this message at 01:26 on Mar 29, 2011

Outlaw Programmer
Jan 1, 2008
Will Code For Food
What Contra Duck just described is called the Template Method design pattern. Sometimes it can be useful but I tend to avoid it. What ends up happening is that you start writing these tiny subclasses that implement bits and pieces, but it's difficult to lose the big picture with the program logic exploded all over the place. Here's a good writeup of the problem and some things you can do about it.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

almostkorean posted:

Right, I'm not using @Override since you can't use it on a field.
@Override doesn't tell the compiler "Override this!"
It says "I am trying to override this, please throw an error to let me know if I'm loving up and not overriding anything."
Using it on a field throws an error to let you know you're                    ^

almostkorean
Jul 9, 2001
eeeeeeeee

Contra Duck posted:

Personally though I wouldn't be using inheritance at all since these two classes really seems to have the same data model and functionality. I'd create one class that does everything for dealing with a locations list of arbitrary length and then just populate the locations list differently in each instance.

I ended up going with this, thanks for the idea. Also thanks to everyone else for all the advice and input, it is much appreciated!

Chairman Steve
Mar 9, 2007
Whiter than sour cream

Aleksei Vasiliev posted:

Using it on a field throws an error to let you know you're...

Not in this case. If you look at the Javadoc[1], the annotation's only targeted to methods. While it's definitely used to let you know that you're not overriding a method when you think you are, the reason it throws an error when used on a field is because it's a compilation error (rather than a "you're not overriding anything" error).

1. http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Override.html

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

I am in posted:

It looks like you're using Eclipse. Go to Window->Preferences->Java->Compiler->Errors/Warnings->Name shadowing and conflicts->Field declaration hides another field or variable and set it to Warning. In fact you can set most of those to Warning.
this owns

Set most of the Ignores to Warning, did a full rebuild, my workspace now has >1500 warnings :v:

Canine Blues Arooo
Jan 7, 2008

when you think about it...i'm the first girl you ever spent the night with

Grimey Drawer
A quicky for those who are better at this than me:

I have a .class file with a method I want to use in a different program. I don't have the .java file or any other file, just the .class file.

How do I configure NetBeans/my project/whatever I need to configure so that I can access that method?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Canine Blues Arooo posted:

A quicky for those who are better at this than me:

I have a .class file with a method I want to use in a different program. I don't have the .java file or any other file, just the .class file.

How do I configure NetBeans/my project/whatever I need to configure so that I can access that method?

You need to know what package the class is supposed to be in, then you need to put it in the correct path. If the package is com.example.test and the class file is Class.class you need:
code:
/com/example/test/Class.class
somewhere in your build path.

As far as configuring your IDE to realize that file is there, that's really more project dependent, so you simply need to either add a build path entry for that file itself, or you need to put it in an already-existing build path.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice
Alternatively, you can use a java decompiler to decompile the class file and just copy/paste the method into your own code.

http://java.decompiler.free.fr/

BlackMK4
Aug 23, 2006

wat.
Megamarm
Is there a way to get Eclipse to take console keyboard input like BlueJ?

mcw
Jul 28, 2005
Hey, can we talk about loggers?

I've used Log4j and never had much trouble, but now my logger knowledge is being put to the test with a Struts project I've inherited. Another Java application is running on the same server, though not in Tomcat-- and without fail, eventually I stop seeing my own code in the log and I start seeing output from that other Java application instead. Some of you folks have probably run into way more logger problems than I have, and I was wondering if you could tell me about some of those problems. Maybe I'll find something in there akin to what's happening in my case.

RitualConfuser
Apr 22, 2008

MariusMcG posted:

Hey, can we talk about loggers?

I've used Log4j and never had much trouble, but now my logger knowledge is being put to the test with a Struts project I've inherited. Another Java application is running on the same server, though not in Tomcat-- and without fail, eventually I stop seeing my own code in the log and I start seeing output from that other Java application instead. Some of you folks have probably run into way more logger problems than I have, and I was wondering if you could tell me about some of those problems. Maybe I'll find something in there akin to what's happening in my case.

Could both apps be grabbing the same log4j config from a common location? Or, are they both configured to write to a log4j server? If both apps were running in the same container, there could be some other issues but, that's all I can think of if they aren't sharing a common classloader.

RitualConfuser
Apr 22, 2008

BlackMK4 posted:

Is there a way to get Eclipse to take console keyboard input like BlueJ?

I haven't used BlueJ but I believe you you can just type into the console window in Eclipse for the app that's running.

BlackMK4
Aug 23, 2006

wat.
Megamarm

RitualConfuser posted:

I haven't used BlueJ but I believe you you can just type into the console window in Eclipse for the app that's running.

Nope :(

RitualConfuser
Apr 22, 2008
Maybe I misinterpreted the question? Here is what I was talking about :

code:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class InputTest {
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String str = reader.readLine();
		System.out.println(str);
	}
}
Right click -> Run as Java Application, then the Window menu -> Show View -> Console, then type in whatever into that console widow in Eclipse then hit enter and it'll echo it back.

BlackMK4
Aug 23, 2006

wat.
Megamarm
edit: I need to sleep more. Bug on my end

BlackMK4 fucked around with this message at 09:29 on Mar 31, 2011

The Cheshire Cat
Jun 10, 2008

Fun Shoe
I've got a simple style question for people. Basically, which of these two is better:

code:
Object o = someHashMap.get("Key");
if(o != null)
    o.doSomething();
else
    //something else
code:
try{
    someHashMap.get("Key").doSomething();
} catch(NullPointerException e) {
    //something else
}
I assume that exception handling has more overhead than creating an extra variable, but is it enough to matter? The broader issue here is I'm not sure how often I should be using try/catch and exceptions. Should I avoid them if possible, or use them as much as I want? In the past, I've found them handy for checking user input that has specific formatting; basically I'd just run the whole input in a try block under the assumption that the user has formatted it correctly, and prompt the user to enter the input again if something like Integer.parse() throws an exception, instead of individually testing every input.

HFX
Nov 29, 2004

The Cheshire Cat posted:

I've got a simple style question for people. Basically, which of these two is better:

code:
Object o = someHashMap.get("Key");
if(o != null)
    o.doSomething();
else
    //something else
code:
try{
    someHashMap.get("Key").doSomething();
} catch(NullPointerException e) {
    //something else
}
I assume that exception handling has more overhead than creating an extra variable, but is it enough to matter? The broader issue here is I'm not sure how often I should be using try/catch and exceptions. Should I avoid them if possible, or use them as much as I want? In the past, I've found them handy for checking user input that has specific formatting; basically I'd just run the whole input in a try block under the assumption that the user has formatted it correctly, and prompt the user to enter the input again if something like Integer.parse() throws an exception, instead of individually testing every input.

There is no hard and fast rule.
Exceptions should always be used for graceful recovery options.
If...elses are okay until you find yourself nested 20 levels deep with no end in site. They become a nightmare.
Exceptions can sometimes be faster for error handling then a set of if...else chains.

In your specific example though, the first option is probably better practice then the second option.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

HFX posted:

There is no hard and fast rule.
Exceptions should always be used for graceful recovery options.
If...elses are okay until you find yourself nested 20 levels deep with no end in site. They become a nightmare.
Exceptions can sometimes be faster for error handling then a set of if...else chains.

In your specific example though, the first option is probably better practice then the second option.

I don't think you should ever be catching a NullPointerException.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Given that exception handling generally interferes with the JIT, I'd imagine it's quite a bit slower than an if...then. It shouldn't make a difference in code that executes infrequently, but exceptions as flow control in a loop is a very bad idea.

edit: And HFX, where the hell are you nesting 20 if statements? Opt-out, use a hash table, break your function into smaller pieces- there's no good reason to have that many nested blocks in a single method.

Internet Janitor fucked around with this message at 23:38 on Mar 31, 2011

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
Alright, I'm back. I've made some progress, too.

I'm currently trying to work on getting this Javamail part of my program to work. I want it to be configurable to match user's own mail servers, however they are setup. The code I've started with is one somebody wrote to work with gmail. Just making it so you can select the mailserver, it now works with google apps domains. Yay! I'm now trying to get it to work with Hotmail. This is where I'm getting a problem.

Hotmail uses TLS/SSL, and something is not going right. The weird thing to me is, Gmail uses TLS as well, and has no problem here. The error message I get reads:

code:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.live.com, port: 587;
  nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525)
	at javax.mail.Service.connect(Service.java:291)
	at MXJEmail.deliver(MXJEmail.java:155)
	at MXJEmail.bang(MXJEmail.java:48)
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:523)
	at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:355)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:798)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1165)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1149)
	at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:503)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:234)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1672)
From what I have read online, the problem is that the TLS handshake is failing, or the server doesn't think it is SSL for some reason. I can't figure this out. My hope is that if I can figure this out, then I can get proper SSL/TLS methods in that will work with the user's server/ports. Anyways, these are the current settings that I'm using:

code:
//Get System Properties object
Properties props = System.getProperties();


//Enable TLS
props.put( "mail.smtp.starttls.enable", "true");

// Define properties
props.put( "mail.transport.protocol", "smtps" );
props.put( "mail.smtp.host", "host" );
props.put( "mail.smtp.auth", "true" );


// tells the system NOT to wait for verification
// of sent status from gmail
props.put( "mail.smtp.quitwait", "false" );

try {

// Get a mail Session object
// Pass SMTP properties to private constructor of new
// Session object
Session session = Session.getDefaultInstance( props );

// deal with transport directly because of tls and ssl
Transport transport = session.getTransport();
So, that's that. I have other questions, but I'll hold off till I get this down.

Contra Duck
Nov 4, 2004

#1 DAD

The Cheshire Cat posted:

I've got a simple style question for people. Basically, which of these two is better:

code:
Object o = someHashMap.get("Key");
if(o != null)
    o.doSomething();
else
    //something else
code:
try{
    someHashMap.get("Key").doSomething();
} catch(NullPointerException e) {
    //something else
}
I assume that exception handling has more overhead than creating an extra variable, but is it enough to matter? The broader issue here is I'm not sure how often I should be using try/catch and exceptions. Should I avoid them if possible, or use them as much as I want? In the past, I've found them handy for checking user input that has specific formatting; basically I'd just run the whole input in a try block under the assumption that the user has formatted it correctly, and prompt the user to enter the input again if something like Integer.parse() throws an exception, instead of individually testing every input.

Choose the first option. In addition to the performance cost of raising the exception and generating a (possibly very long) stack trace, you have no idea if the NPE came from someHashMap.get("Key") being null or if it was generated inside doSomething().

covener
Jan 10, 2004

You know, for kids!

WrongWay Feldman posted:

From what I have read online, the problem is that the TLS handshake is failing, or the server doesn't think it is SSL for some reason. I can't figure this out. My
...
props.put( "mail.smtp.starttls.enable", "true");

Maybe your problem is talking SSL directly to a service that is expecting starttls over a plaintext connection (which is like an in-line upgrade from plaintext to ssl)?

HFX
Nov 29, 2004

Internet Janitor posted:

Given that exception handling generally interferes with the JIT, I'd imagine it's quite a bit slower than an if...then. It shouldn't make a difference in code that executes infrequently, but exceptions as flow control in a loop is a very bad idea.

edit: And HFX, where the hell are you nesting 20 if statements? Opt-out, use a hash table, break your function into smaller pieces- there's no good reason to have that many nested blocks in a single method.

Other peoples 500+ line functions where you need to acquire several resources, do something with them, and then continue onto the next line with more acquisition's depending on the success of the original. The original authors though exception handling would cause to much overhead.

Refactoring is often frowned upon for time / cost / it worked before reasons.

fletcher posted:

I don't think you should ever be catching a NullPointerException.

There is a chance from interfaces to non Java libraries where it is acceptable. It also tends to happen in a lot of multithreaded code I end up fixing. Else I am testing for null pointers all the time which just makes the code harder to read.

Exyphrius
Jan 24, 2011
Okay, my question might seem like a stupid one, but "There are no stupid questions.", right?

Okay, so, I've been coding for about 3 or 4 months now, mostly in Actionscript 3.

About a week and a half ago, I started reading Head First Java and started making some simple Java programs. Well, something that I don't quite understand is the arguments in the main class. Whenever I see a newly defined Main function in the book, it always looks like this.

"public static void main(String[] args)"

My question is... What is the purpose of: "static"? "String[]"? and "args"? I understand the rest of it, but not these parts.

Also, why don't other functions need these arguments/declarations? (I assume that will be answered in answering the first question, but just in case it isn't, answering that also would be great.)

Thanks in advance. :)

1337JiveTurkey
Feb 17, 2005

If you call a program from the command line, normally you can include stuff beyond just the program name. For instance a program that copies a file would take the existing file and the name of the file you want to copy it to. In that case you would expect for the existing file name to be in args[0] and the new file name to be in args[1]. This is similar to how it's done in other languages like C, although in C the first parameter is always the name of the program being called (useful in some circumstances).

Amarkov
Jun 21, 2010

Exyphrius posted:

Okay, my question might seem like a stupid one, but "There are no stupid questions.", right?

Okay, so, I've been coding for about 3 or 4 months now, mostly in Actionscript 3.

About a week and a half ago, I started reading Head First Java and started making some simple Java programs. Well, something that I don't quite understand is the arguments in the main class. Whenever I see a newly defined Main function in the book, it always looks like this.

"public static void main(String[] args)"

My question is... What is the purpose of: "static"? "String[]"? and "args"? I understand the rest of it, but not these parts.

Also, why don't other functions need these arguments/declarations? (I assume that will be answered in answering the first question, but just in case it isn't, answering that also would be great.)

Thanks in advance. :)

As you (presumably) know, all Java code is part of some class. By default, methods in a class are instance methods, which means they're called on some specific instance of the class. The static keyword before a function modifies this. A method declared static is what's known as a class method; it's called on the class as a whole, and doesn't require any instance of the class to exist. Which you need for the main function, because otherwise you'd have to generate an object of the class before you call it.

"String[] args" just means that the main function accepts the argument args, which is an array of strings. When you run a program from the command line, each element of args will be one of the command line arguments.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
As for the name of the method (main), it's a convention that is used so that the java virtual machine can always find the right starting point for your program.

Exyphrius
Jan 24, 2011
Thanks for your answers so far guys. :)

One question...

Amarkov posted:

A method declared static is what's known as a class method; it's called on the class as a whole, and doesn't require any instance of the class to exist.
Okay, so, if I were to create a seperate class.. let's call it Dog.. and I gave it a public, static function named "Bark", I could use Bark without calling the Dog class?

Also, if this is not the case, then what if Bark, when called, used a variable inside of Dog in it's calculation?

Another question...

Amarkov posted:

"String[] args" just means that the main function accepts the argument args, which is an array of strings. When you run a program from the command line, each element of args will be one of the command line arguments.
Could you perhaps give me an example of code like this? Perhaps an example of 1337JiveTurkey's situation, so that I understand it better?

Also, is that even necessary? For example, could I leave out the "String[] args"?

Again, thanks guys. :)

ShardPhoenix
Jun 15, 2001

Pickle: Inspected.

Exyphrius posted:

Thanks for your answers so far guys. :)

One question...

Okay, so, if I were to create a seperate class.. let's call it Dog.. and I gave it a public, static function named "Bark", I could use Bark without calling the Dog class?

You would call it on the class instead of any given instance. So you would do Dog.Bark() instead of Dog myDog = new Dog(); myDog.Bark(). However, note that for this method this is a bad design - a particular dog should be doing the barking, not the abstract notion of a dog.

quote:

Also, if this is not the case, then what if Bark, when called, used a variable inside of Dog in it's calculation?
Static methods can only refer to variables that are themselves declared static.

quote:

Another question...
Could you perhaps give me an example of code like this? Perhaps an example of 1337JiveTurkey's situation, so that I understand it better?

Also, is that even necessary? For example, could I leave out the "String[] args"?
See here: http://download.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html. And it's required even if you don't use the arguments.

Exyphrius
Jan 24, 2011
Thanks a TON, ShardPhoenix. I think you just wrapped up my entire line of questions on this subject. :)

Again, thank you all very much. I'll be sure to come back with any menial question I have. :)

Oxyclean
Sep 23, 2007




Both of these buttons are contained in JPanels (label,textfield,button) and (field,button), is there a way to make the buttons the same height as the textfields? Preferring without using preferred height.

e: It's for an assignment, so that doesn't really matter, but I guess I'll keep that in mind for my own stuff.
e2: Hmm, well setpreferred size works, but I had the impression I was supposed to do another way.

Oxyclean fucked around with this message at 14:36 on Apr 6, 2011

Paolomania
Apr 26, 2006

Gah! Don't use the motif look & feel it is disgusting.

code:
// somewhere in main() before you create your top level window
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

Jam2
Jan 15, 2008

With Energy For Mayhem
Guys, Does this 7-week course in Java seem like a worthwhile endeavor for a relative noob?

quote:

Intensive Introduction to Computer Science Using Java

Henry H. Leitner and David G. Sullivan.

Class times: Mondays-Fridays, 8:30-11:30 am. Required sections to be arranged.

Course tuition: noncredit, undergraduate, and graduate credit $5,280.

This course is a serious, fast-paced first course in computer science, designed for students who plan to work extensively with computers (for example, engineers, biologists, physicists, and economists), as well as future concentrators who plan to take more advanced courses in the field.
Using Java programming language, students learn problem-solving strategies through the development of algorithms that emphasize modern, object-oriented designs (including encapsulation and abstract data types). Related topics cover

recursion and
recursive backtracking,
file I/O,
exception handling, and
graphical-user interfaces. This course also covers fundamental
data structures, including
lists,
stacks,
queues,
trees, and
graphs, and it examines classic
algorithms that use these structures for tasks such as
sorting,
searching, and
data compression.

Techniques for analyzing the efficiency of algorithms are also studied. Problem sets require a minimum of 20 hours of programming each week in a Unix environment. Graduate-credit students are expected to complete additional work. This course provides complete coverage of the syllabus for the advanced placement examination in computer science. Prerequisite: familiarity with precalculus.

(8 credits)

Harvard Summer School 2011

Dransparency
Jul 19, 2006

Jam2 posted:

Guys, Does this 7-week course in Java seem like a worthwhile endeavor for a relative noob?

Some people discussed this course earlier over here.

HFX
Nov 29, 2004

Paolomania posted:

Gah! Don't use the motif look & feel it is disgusting.

code:
// somewhere in main() before you create your top level window
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

It isn't that ugly. Also, you can save yourself some headaches sometimes by using motif if you expect it to run on more then just one platform.

Speaking of which, I need to go fix an interface because some idiot thought it is a good idea to resize it to the size of my screen upon opening the application. This is annoying. Then again, so is using the swing thread to handle connections to a server and force alerts to you that you can't dismiss easily.

HFX fucked around with this message at 17:55 on Apr 6, 2011

lamentable dustman
Apr 13, 2007

ðŸÂ†ðŸÂ†ðŸÂ†

Jam2 posted:

Guys, Does this 7-week course in Java seem like a worthwhile endeavor for a relative noob?

What are you trying to get out of it? If going for a CompSci degree does it take the place of 100 level courses? It seems pretty brutal but if you have programming experience it shouldn't be that bad.

Adbot
ADBOT LOVES YOU

kimbo305
Jun 9, 2007

actually, yeah, I am a little mad
I'm getting the following cast exception from deep in the bowels of a library I'm using:

java.util.ArrayList cannot be cast to [B

Googling for "cannot be cast to [B" doesn't bring up much, and it doesn't help that Google doesn't accept like weird characters in literal strings.

Thanks to this weird error message, I can't tell whether it's my code's fault or some intermittent thing. I'm pulling out the data that was being processed when I ran into this and hope to be able to replay it tomorrow to see if it's repeatable.

But in the meantime, does anyone know what [B represents? Is it an internal primitive of some sort?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply