Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #22377

Re: HttpURLConnection

Newsgroups comp.lang.java.programmer
Date 2013-02-19 14:31 -0800
References <30772112-527f-47b0-9333-70777b889b5c@googlegroups.com>
Message-ID <a4077e75-4640-44be-a415-44fbf0fa5f48@googlegroups.com> (permalink)
Subject Re: HttpURLConnection
From Lew <lewbloch@gmail.com>

Show all headers | View raw


On Tuesday, February 19, 2013 1:45:25 PM UTC-8, bob smith wrote:
> How can people use the class HttpURLConnection when the abstract method connect()
> from URLConnection is never defined?

False.

> I thought you can't use a class till all the abstract blanks are filled in?

True.

Look up polymorphism and widening conversions.

http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.5

Understand the difference between declared type (compile time) and run-time type.

Read the Java tutorials.

Did you know that any object of a given type is also an object of every supertype of its type?

That's how you can get 

List<Foo> foos = new ArrayList<>();

'List', being an interface, has only abstract instance methods. Yet somehow you can call 

foos.add(new Foo());

Same thing.

This is basic Java stuff. Heck, it's basic O-O stuff. Google around for some introductory texts.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

HttpURLConnection bob smith <bob@coolfone.comze.com> - 2013-02-19 13:45 -0800
  Re: HttpURLConnection Lew <lewbloch@gmail.com> - 2013-02-19 14:31 -0800
  Re: HttpURLConnection Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-19 17:56 -0500
    Re: HttpURLConnection bob smith <bob@coolfone.comze.com> - 2013-02-20 10:26 -0800
      Re: HttpURLConnection Arne Vajhøj <arne@vajhoej.dk> - 2013-02-22 13:28 -0500
  Re: HttpURLConnection Roedy Green <see_website@mindprod.com.invalid> - 2013-02-20 22:05 -0800

csiph-web