here is my code ... -
import org.iitkan.*;
-
import org.iitkgp.*;
-
-
public class AnotherTest {
-
public static void main(String a[]){
-
System.out.println("Debasis ...!!!!");
-
Test t = new Test();
-
}
-
}
-
The Test class exists in three packages .. org.iitkan, org.iitkgp and the default package. If i run this program then it runs well. How a class gets looked into the packages?
Here what's happening, first compiler look into the default package if not then ambiguity error flashed(if a class found in two imported different packages)? ;)
11 2198
Are you saying you compiled and run the code or are you asking whether the code compiles or not?
No no ... I am just asking what's the way to find out a class during compilation?
I really can't make sense of the question.
If you want to know whether the code compiles or not, then just try it and see what will happen.
@r035198x
No no ..means ...
I compiled the code and ran it ;)
But i wanted to know the way of looking for a class.
@dmjpro
A class is visible if it is an element of the class (to be compiled) from the same package or, if it has been made visible explicitly by an import statement. If more than one class with the same simple name is visible the simple class name is ambiguous and the compiler emits an error message. Read the JLS for a more detailed description.
kind regards,
Jos
So i looked at the contents of JLS 3rd edition, but i could not find it out.
@dmjpro
Well, that's easy then: give up, don't read the JLS and take my terse explanation for granted. The JLS is not a novel, i.e. you can't just 'look at the contents' and understand what it's all about; it takes reading and understanding. That's how language definitions are written.
kind regards,
Jos
:) actually to read out the whole JLS .... oops !
That's what (patience) i lack ;)
@dmjpro
Well, you'd better give it a try, it is worth it; reading the JLS is not like browsing, skimming through something, copy and paste a few examples and have some half understood code up and running after some hacking.
A JLS is the definition of a language and it has to be exact in its wordings; it was (most likely) written by some language lawyers. Read it as such. Believe me, the JLS reads like a simple novel compared to the ANSI/ISO texts for the C OR C++ programming languages.
kind regards,
Jos
Well .. impressive! ;)
But at the beginning there are some topics which is related to Automata Theory.
So from where i should start of?
@dmjpro
They talk about grammars: the lexical grammar that defines the sequence of characters that make up valid tokens and the syntactical grammar that defines the syntactically valid sequences of tokens that make up valid program fragments. If grammars are not your cup of tea feel free to skip those sections.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dumboo |
last post by:
hi there
i m having a base class
class base
{
...
};
and two derived class, which have inherited 'base' but the inheritance is
not virtual
|
by: Richard Cavell |
last post by:
#include <string>
using std::string;
#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
void My Function(string ParameterOne, string ParameterTwo)
{
int i, j;
string MyString = "hello";
|
by: Erik Arner |
last post by:
Hi, I really need some help here. After upgrading to g++ 3.4 I have run
into all sorts of troubles that I'm sure depends on my lack of proper
understanding of C++. I would now like to get it right...
|
by: Franck PEREZ |
last post by:
Hello,
I'm developing a small XML marshaller and I'm facing an annoying
issue. Here's some sample code:
########### My test application ############
class Foo(object):
#The class I'd like to...
|
by: Gregory |
last post by:
I have a question about using STL containers in C++ class public
interface.
Lets say that I want to return some container from class method or
accept class method parameter as some container. For...
|
by: ciaran.mchale |
last post by:
I used Google to find information about JAXB 2.0 and I ended up
downloading a document called "The Java Architecture for XML Binding
(JAXB) 2.0: Proposed Final Draft September 30, 2005".
...
|
by: silversurfer2025 |
last post by:
Hello world,
I seem to go from one tricky error to the other (at least tricky for
me). I am using qt and another code-package where many other files are
stored which I need (written by someone...
|
by: Jo |
last post by:
Hi,
Is there a generic way to access the (virtual) functions in the base
class of a class?
Like in:
if (!this->Foo(something)) return(((Base*)this)->Foo(something)); // for
a normal member...
|
by: dmjpro |
last post by:
What would be the better, whether should i access the static members using class name or using Object? Which one is preferred(low-cost effective)?
Today a thing stroke into my mind... Java...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |