473,407 Members | 2,315 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,407 software developers and data experts.

Import declaration

23
Hey, I have a small style question. Which import style is preferable (or better) to use. A single one like
Expand|Select|Wrap|Line Numbers
  1. import java.util.System;
or an import-on-demand like
Expand|Select|Wrap|Line Numbers
  1. import java.util.*;
? Is there any advantage or disadvantage for each declaration? Thank you.
Apr 12 '08 #1
3 2448
sukatoa
539 512MB
Hey, I have a small style question. Which import style is preferable (or better) to use. A single one like
Expand|Select|Wrap|Line Numbers
  1. import java.util.System;
or an import-on-demand like
Expand|Select|Wrap|Line Numbers
  1. import java.util.*;
? Is there any advantage or disadvantage for each declaration? Thank you.
They are the same... the JVM have it's built in code optimizer.... it removes unnecessary codes/excess codes....

But for me, it is nice to show the specific import.... so that, when i have a problem/ forgot how to implement like this, i can scan easily my previous programs/codes for review.....

for example, i forgot on how to use FileNameExtensionFilter...
so i could just view my previous codes who has an import with the FileNameExtensionFilter....

i have subreasons.... yet nonsense... :)

So, depends on you....


sukatoa
Apr 12 '08 #2
rpm27
23
Yes, right after writing this post, I convinced myself that import individual classes would help me as I'm a Java beginner. Thanks anyway. :-)
Apr 12 '08 #3
r035198x
13,262 8TB
Yes, right after writing this post, I convinced myself that import individual classes would help me as I'm a Java beginner. Thanks anyway. :-)
You could even write code without using the import statement as well.
The import statement just saves you a lot of typing.
Apr 14 '08 #4

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

Similar topics

9
by: Frantisek Fuka | last post by:
This thing keeps bugging me. It's probably some basic misunderstanding on my part but I am stumped. Let's say I have two Python files: file.py and file2.py. Their contents is as follows: ...
4
by: MackS | last post by:
Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main():
4
by: dharmesh Gupta | last post by:
Hi, i have a program splitted across two files main_prog.cpp idr.cpp my main_prog.cpp accepts a file name a s parameter. i want to capture this file name in a variable and use it in idr.cpp ...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
0
by: Vagabond Software | last post by:
I am trying to import xml files, that contain a DOCTYPE declaration and accompanying DTD file, and report the data to worksheets in an Excel Workbook. If I try to simply import the files from...
9
by: fegge | last post by:
i have written script save as hello.py. i can run it. but why cant i import it as a modular in other programs?
1
by: user | last post by:
Hi, I've a custom control and here are it's contents: mypanel.asx -------------------------------------- <%@ Import Namespace="mylib" %> <%@ Assembly Src="mylib.vb" %> <script...
3
by: stuntgoat | last post by:
import zlib works in Python 2.4 (debian etch AMD64 - default python version for that distro) I built python 2.5 from source; zlib is not importable. I am trying to compile MySQLdb. any...
0
by: Murat Gunduz | last post by:
Dear list member, I am using a Linux machine (Fedora Core 7, 64 bit): Linux 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 14:56:37 EDT 2007 x86_64 I tried to compile a software (ncvtk) with the simple...
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.