This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

getCodeBase().getHost()  RSS feed

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
what is meaning of this : getCodeBase().getHost()
Thanks in advance,
angela
 
Brett Spell
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angela,
Any time you have a question about what a method does, the best place to look is the API documentation. You can find a copy of it online at
http://java.sun.com/j2se/1.3/docs/api/overview-summary.html
The place to start is to know which class is involved. In this case, I'm assuming that the code you posted came from a class that extends java.applet.Applet, so you'd want to look in the java.applet package at the documentation for the Applet class. As the documentation indicates, getCodeBase() returns the URL from which the applet was downloaded, and if you follow the hyperlink for URL (displayed in the left column of the "Method Summary" table), you can find the documentation for getHost(). As it indicates, that method returns a String representing the name of the host associated with the URL. In other words, the code snippet you posted returns the name of the server from which the applet was downloaded.
------------------
Brett Spell
Author, Professional Java Programming
[This message has been edited by Brett Spell (edited March 22, 2001).]
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Brett,
Angela

Originally posted by Brett Spell:
Angela,
Any time you have a question about what a method does, the best place to look is the API documentation. You can find a copy of it online at
http://java.sun.com/j2se/1.3/docs/api/overview-summary.html
The place to start is to know which class is involved. In this case, I'm assuming that the code you posted came from a class that extends java.applet.Applet, so you'd want to look in the java.applet package at the documentation for the Applet class. As the documentation indicates, getCodeBase() returns the URL from which the applet was downloaded, and if you follow the hyperlink for URL (displayed in the left column of the "Method Summary" table), you can find the documentation for getHost(). As it indicates, that method returns a String representing the name of the host associated with the URL. In other words, the code snippet you posted returns the name of the server from which the applet was downloaded.


 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!