473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Imports and the asterix.

Markus
6,050 Expert 4TB
I'm just reading up on using MySQL in Java, and, during said reading, I stumbled across something that didn't quite make sense.

Consider the following, taken from http://java.sun.com/developer/techni...ndex.html#test.

Expand|Select|Wrap|Line Numbers
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.SQLException;
  4. import java.sql.*;
  5.  
  6. public class MySQLclient {
  7. [...]
  8.  
If you are going to include every possible library (.*), why would you give specific libraries first? Am I misunderstanding the import java.pkge.* pattern?
Jun 3 '09 #1
4 2110
JosAH
11,448 Expert 8TB
@Markus
You're right: if the entire package (not 'library') is imported it is no use to import single classes from that package as well. It doesn't harm but it looks silly ;-)

kind regards,

Jos
Jun 3 '09 #2
Markus
6,050 Expert 4TB
@JosAH
Okay, thanks.

You're right: if the entire package (not 'library')
So, java.sql.Connection is not a library, but a package?

When I say import every possible library, I mean import every possible library in the package.
Jun 3 '09 #3
JosAH
11,448 Expert 8TB
@Markus
No that Connection thing is a class; the * import imports all the classes contained in a package. The Connection class is stored in the java.sql package.

kind regards,

Jos
Jun 3 '09 #4
Markus
6,050 Expert 4TB
@JosAH
Righteo, I get you.

Cheers,

- Mark.
Jun 3 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steven K | last post by:
Hello, Is there a way to declare imports so that they don't have to be declared both in Master Page.vb and the Content Page.vb? For example, I have the following in the Master Page.vb Imports...
19
by: Tiraman | last post by:
Hi , I have an assembly that hold few class and few imports which are not used in all of the class's . so my question is when to use the "Imports XXX" And when to use this kind of statement...
4
by: Jeff Jarrell | last post by:
I am not really there yet with namespaces. I have a "common.dll" that is referenced from another project. now in the consuming project, source file to i'd like to have a "imports common". ...
2
by: Mike C | last post by:
I have an account list. There's an asterix in the account name if it has closed. For example, Acm* Corp. I don't agree with this design but that's what our company came up with. Anyway, I'm trying...
1
by: Arpan | last post by:
What's the difference between "Imports" & "Inherits"? For e.g. both the codes below work without any errors: Imports System Imports System.Data Imports System.Web.UI Namespace Constructors...
1
by: Thomas Wittek | last post by:
Hi! Is there any possibility/tool to automatically organize the imports at the beginning of a module? I don't mean automatic imports like autoimp does as I like seeing where my...
5
by: kimiraikkonen | last post by:
Hello, I want to ask about "imports" statement. Some projects must be inserted with "imports xxxx" statements before beginning coding. But how do i know when to use or do i have to use "imports"...
2
by: dale5804 | last post by:
hi im using the code below to password protect a button on a form.... is there any code i can use within the below to *asterix* out the password when typed in cheers. Private Sub...
0
by: Kay Schluehr | last post by:
Since their introduction in Python 2.5 I only reviewed the new "relative import" notation briefly by reading the "What's new in Python 2.5" article. Now I wanted checkout if I get comfortable with...
3
by: Mohamed Yousef | last post by:
Hello , The problem I'm asking about is how can imported modules be aware of other imported modules so they don't have to re-import them (avoiding importing problems and Consicing code and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.