User defined package problem 1 Answer(s) 3 years and 9 months ago
Posted in : Java Beginners
View Answers
September 1, 2009 at 6:27 PM
How do you access non static method of a class ? i.e. obj.method() right !
So, if u have a class which is not having the given method how will u access it ? Just study the following code carefully
class A { int a; void show() { System.out.print("a is "+a); } } class B { public static void main(String args[]) { B bobj=new B(); bobj.a=100;//1 bobj.show();//2 } }
Lets forget about class A for timbing. Look at class B............... It does not have a member so called 'a' and not even show(). Hence compiler will definately give an error.
above prg compiles if We write class B as class B extends A
Coming to ur prg. The error is you can access Public_Demo1 member method only if have instantiated (created an object) of it in Public_Demo2. So, try it out, as package mypack1; class Public_Demo2 { public static void main(String ar[]) { Public_Demo1 pd=new Public_Demo1(); pd.show(); } } }
your prg will compile. you must be wondering why eg with no package statement is being provided to u. Its because classes/interfaces with no package statement is put into a default package thats without a name. so eg provided will work similarly to which u have tried. if u still wish to add a package statement u can go ahead. Happy programming..............
Related Pages:
User defined package problem - Java Beginners Userdefinedpackage problem Hello friend,
i was trying to execute the user-defined packages according to the chart that has been given..., it has been given that default members can be accessed "within the same package non
verfication of user login and then redirecting it to user defined page
verfication of user login and then redirecting it to userdefined page ...() to redirect to a userdefined page..but..wen i press the submit button,the html page calls teh servlet..but..the servlet.is not redirecting to a userdefined
USER DEFINED CLASS USERDEFINED CLASS hi please help me with my project:
Exercise # 1
Create a java program for a class named MyDate that contains data members and a constructor that meet the criteria in the following list. This class is used
problem with package problem with package Dear sir,
i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
package: package: i hv created created a package and save it into D... but it can't run with following command:
java mypackage.classname
what's problem... in a package world. The we specify the keyword package with the name
package: package: i hv created created a package and save it into D... but it can't run with following command:
java mypackage.classname
what's problem... in a package world. The we specify the keyword package with the name
package
package write a package for games which have two classes indoor... specifier and also use the finalize() method
We have created a package named games where we have defined two classes Indoor and Outdoor. In the main
Java package
; (userdefined) in our
program, its name would crash with the Date class of java.util
package. To avoid this problem, we can use Package through...
Java package
 
Java User-defined Exception
Java User-defined Exception
In this tutorial, you will learn about the User-defined Exceptions. These
custom exceptions actually all the programmer... a userdefined
exception if the student marks entered, is less than fifteen
user defined styles for datetimepicker in struts2 userdefined styles for datetimepicker in struts2 Hi,
I am using dojo plugin for displaying datetimepicker. i want to change the colour of the date picker which is in "blue" by default .
Please any one can help me
user defined styles for datetimepicker in struts2 userdefined styles for datetimepicker in struts2 Hi,
sample code:
<%@taglib prefix="sx" uri="/struts-dojo-tags"%>
Issue:
I need to have my own styles for the displyed date picker.
is it possible?
Can anyone help
PHP User Defined Function
PHP UserDefined Function
An user-defined function saves us from rewriting the same code
again and again and helps us to make our application...
functions as per the need. General structure of the userdefined function
JavaScript User Defined Functions
JavaScript User-Defined Functions:
An user-defined function saves us from rewriting the same code
again and again and helps us to make our... can make
your own as per the need. General structure of the userdefined
Making Custom (User Defined) Exceptions
Making Custom (UserDefined) Exceptions
 ...
Making Custom (User Define Exceptions)
So far you would have been known, how... appropriate and that mechanism of handling exception is
called Custom or User
Remove attribute in user defined session - JSP-Servlet
Remove attribute in userdefined session Hi, How we can set remove attribute for userdefined session. I am appreciating if you are sending solution as soon as possible? Thanks, Sanat Kumar
Introduction to java.sql package
have been truncated.
7). Custom mapping an SQL user- defined type (UDT...
Introduction to java.sql package
This package provides the APIs for accessing
to make a google map point to user defined location
to make a google map point to userdefined location Hi,
i wish to develop an google map,that takes the input from a form(city,area &Country... the desired location of the user
user defined subclass of throwable class - Java Beginners userdefined subclass of throwable class Dear Sir,pls help me to write this pgm:
Program to illustrate the use of userdefined subclass of throwable class Hi Friend,
Try the following:
1)
public class
jsp- adding user defined functions to a jsp
jsp- adding userdefined functions to a jsp Trying to write the function as below but getting errors. Can you please identify the cause of error and how to correct it.
<%
public String retrieveAndClearErrorMessage
URGENT: User Defined Classes - Java Beginners
URGENT: UserDefined Classes Can someone help me?
Design and implement the class Day that implements the day of the week in a program. The class... the definitions of the methods to implement the operations for the class Day, as defined
import user-define package - Applet
import user-define package how to import user-define package to the frame/graphic of the applet.
could i create a new frame or not ??
please help me ... Hi friend,
import java.io.*;
import java.awt.*;
import
Using a user defined non-packaged servlet class in jsp. - JSP-Servlet
Using a userdefined non-packaged servlet class in jsp. i want know that how to use a userdefined java servlet function's, variables and methods of a userdefined java servlet in jsp.if possible plz try to explain with a simple
user-define package for applet - Java Beginners user-define package for applet how to import a user-define package to applet ?? Hi
import javax.swing.*;
import java.awt.Graphics;
import javax.swing.JApplet;
public class WelcomeLines extends JApplet
how to import user-define package to applet - Applet
how to import user-define package to applet how to import user-define package to applet...
can u write a java coding can execute in jdk only ....
thx... Hi friend,
import java.applet.*;
import java.util.
Java AWT Package Example
in the Java AWT package for developing user interface for your program.
AWT...
Java AWT Package Example
In this section you will learn about the AWT package of the Java
User Defined Exception UserDefined Exception
 ....
How to Handle and create User-defined Exception
The keywords used...
Understand User-Defined Exceptions with Example-
In the given below code
User Defined Exception UserDefined Exception
 ....
How to Handle and create User-defined Exception
The keywords used...
Understand User-Defined Exceptions with Example-
In the given below code
Servlet problem problem from last three month and now i hope rose india developers... connectivity code it works but problem is with servlet page.
My servlet code is below
package record;
import javax.swing.*;
import java.io.IOException
The package keyword
The package keyword
The package in java programming language
is a keyword that is used to define a package that includes the java classes. Keywords
are basically reserved words
problem of static in jsp page by multiple user access problem of static in jsp page by multiple user access hi ,
i am continuing my online exam project,but i have a Singleton class which i am invoking from my jsp page , ths page can access by more number of users .every user
Joomla Starter Package
Joomla Starter Package
This is a basic package in which we offer all the necessary features that needs a basic package. This package can be managed,
updated and handled by the user itself easily and also can be upgraded
use of package concepts
use of package concepts i m getting error when i use .* method to access all package files. when i use this through another method like... want to use packagename.* methhod.
please solve the problem.
i just start
in javax.swing package setBounds
in javax.swing package setBounds Hello
some body has given the solution to my setBounds problem .But i didnot mean to tell how it is used in the program,but what do u mean of values refer to in SetBounds().For ex
Package categories in Java Package categories in Java
 ... hierarchy
structure shown above. Note that, the package "java" also has
subpackages in which the package "awt" is further has a
subpackage called
java awt package tutorial
Java AWT Package
In Java, Abstract Window Toolkit(AWT) is a platform independent
widget toolkit for windowing, graphics, and user-interface.
As the Java... of tools is provided by the AWT for graphical user interface
design
Package
Package Create a Package named com.example.code. Write few classes, interface and abstract classes. Now create a class names PackageDemo that uses the classes of this package from other package
Package
Package Create a Package named com.example.code. Write few classes, interface and abstract classes. Now create a class names PackageDemo that uses the classes of this package from other package
package
package by what name we can save a java file that contain a package {i.e package p;}
and several public classes {i.e public class abc}
but not a main method
package
package hello,
What is a package?
hello,
To group set of classes into a single unit is known as packaging. Packages provides wide namespace ability
package
can allow types in one package to have unrestricted access to one another, still restricting the access for the types outside the package
Servlet Problem proceed - JSP-Servlet
Servlet Problem proceed Thank you fro your reply.
But I couldnt find any serious error.Please see this. User is the package
classes/User... servlets mapping is correct. If your package name is User,
if you were any
problem 1 - Java Beginners
This program does NOT require you to create a user-defined class (reference type...problem 1 Hi,
please help me!!!! How can i code in java using Two-dimensional Arrays? This question is related to the one i posted before
user validation user validation i hv just started with my lessons in jsp n also doin my final yr project in jsp.i m doin the login page & m stuck with a problem...(request.getParameter("user"))
&& passwrd.equals(request.getParameter("pass
package
package Smith has created a package named ApplianceDetails that contains the Appliance class.Now he wants to create a class named NewAppliance that stores the details of the newly launched appliances.He uses the following syntax
package
package Smith has created a package named ApplianceDetails that contains the Appliance class.Now he wants to create a class named NewAppliance that stores the details of the newly launched appliances.He uses the following syntax
java problem - Java Beginners
number system uses only two digits, 0
and 1. There are pre-defined methods... a program that prompt user to enter a denary integer, and
convert and display... without using the pre-defined method. If you want, you may write a method
pagination problem - JSP-Servlet
(),my problem is that where i have to put & how to do pagination?
my code as follows.
//EmployeeCheckServlet.java
package com.antares.servlet;
import... = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@twtesting:1550:orcl1";
String user