|
Sorry. I see, I only skimmed the reference I gave you; after a careful read it tells me it can't be done in Java, at least not in the way it gets done in C#, which I am familiar with. So you'd have to go another route, such as the proxy jschell suggested.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
faheemnadeem wrote: Kindly can you please give me a solution to this..
Almost always the answer to this sort of problem is that someone is overusing inheritance.
But if you must implement both then you MUST have two classes.
To achieve functional equivalence you can create a proxy for one case.
So your ILamp proxy class would take an instance of the worldlamp class in its constructor.
|
|
|
|
|
Can you please give me a small sample implementation based on the structure given above... as i have no clue about proxy classes.
I would be really thankful.
|
|
|
|
|
public class Worldlamp extends Service
{
...
}
public class LampProxy implements ILamp
{
LampProxy(Worldlamp w)
{
}
}
|
|
|
|
|
I need the code of the java chess for a project I have to do ....
|
|
|
|
|
And I could really use some coffee?
Seriously do your own work and if you get stuck somewhere come back here and ask a specific question.
|
|
|
|
|
|
I need a lot of things too
I cannot remember: What did I before google?
|
|
|
|
|
indeed, you need to be a lot more specific.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
I want a program in Java that have two forms server and client
there are in client 2 text box and one button
that when we insert 2 number in two text box and click ok button send numbers to server and Sum 2 number in server then post to client and show result number
tnx
|
|
|
|
|
The first thing I would recommend is that you read point (2) of the Forum Guidelines. If you have a question people will be happy to help but no-one on this forum is going to do your homework for you.
|
|
|
|
|
You do not give much of a clue as to what level of experience you have of writing Java programs, but I expect you can find most of what you want from here[^].
The best things in life are not things.
|
|
|
|
|
hi
i coded Set program but when i want to run this code it says NO MAIN CLASSES FOUND!!!
whats wrong?
code:
package set;
import java.util.Scanner;
import java.io.IOException;
import java.awt.*;
import java.applet.*;
public class Set {
private char[] a;
public Set(char a[]){
for(int i=0;i<a.length;++i)
a[i]=0;
}
public void get() throws IOException{
Scanner inp=new Scanner(System.in);
System.out.println("enter set A:");
for(int i=0;i<a.length;++i)
a[i]=(char)System.in.read();
}
public void print(){
for(int i=0;i<a.length;++i)
System.out.print(a[i]);
}
public void main(String[] args) throws IOException {
Set c=new Set(a);
c.get();
c.print();
}
}
|
|
|
|
|
The standard signature for main in Java is:
public static void main(String[] args)
Your definition omitted the static modifier.
The best things in life are not things.
|
|
|
|
|
please help me.. how to build simple Content Based Image Retrieval using java
and how to storing database multimedia such as image database..
using xml or another??
please help..
need helping
|
|
|
|
|
hendrik.sps wrote: need helping
That much is clear, but your question is far too large for a forum like this. Take a look at the Java Tutorials[^] for ideas on the classes you would need and how to access database information.
The best things in life are not things.
|
|
|
|
|
simple Content Based Image Retrieval
what's that? please explain what's meant. A good answer should be worth more than 4 word of explanation.
pictures can be stored in databases - otherwise you would not be able to see them on your favorite por on the web
regards
Torsten
I never finish anyth...
|
|
|
|
|
hi ,
I want to record audio from microphone and video from webcam when click on button and allow user to store it on local derive and then allow user to play back it .
then i want to transfer it through network by using RTP protocol , how i can make it in netbeans program with java ??
thanks .
|
|
|
|
|
That's a fairly big request which really cannot be answered in a forum like this. Try a bit of research on the subjects you are interested in implementing: this page[^] could be a good starting point.
The best things in life are not things.
|
|
|
|
|
Helo,
media streaming .... take a look to Adobe Flash.
Cu.
|
|
|
|
|
its so easy to do it in JMF(JAVA Media FrameWork).
try to read about it.
gd luck
|
|
|
|
|
hi
i coded a java class, now i need to change it to c++ code, but i am not expert in c++. can any body change the code to c++ for me?
plz i need it!!
public class Polynomial {
private int[] coef;
private int deg;
public Polynomial(int a, int b) {
coef = new int[b+1];
coef[b] = a;
deg = degree();
}
public int degree() {
int d = 0;
for (int i = 0; i &lt; coef.length; i++)
if (coef[i] != 0) d = i;
return d;
}
public Polynomial plus(Polynomial b) {
Polynomial a = this;
Polynomial c = new Polynomial(0, Math.max(a.deg, b.deg));
for (int i = 0; i &lt;= a.deg; i++) c.coef[i] += a.coef[i];
for (int i = 0; i &lt;= b.deg; i++) c.coef[i] += b.coef[i];
c.deg = c.degree();
return c;
}
public Polynomial minus(Polynomial b) {
Polynomial a = this;
Polynomial c = new Polynomial(0, Math.max(a.deg, b.deg));
for (int i = 0; i &lt;= a.deg; i++) c.coef[i] += a.coef[i];
for (int i = 0; i &lt;= b.deg; i++) c.coef[i] -= b.coef[i];
c.deg = c.degree();
return c;
}
public Polynomial times(Polynomial b) {
Polynomial a = this;
Polynomial c = new Polynomial(0, a.deg + b.deg);
for (int i = 0; i &lt;= a.deg; i++)
for (int j = 0; j &lt;= b.deg; j++)
c.coef[i+j] += (a.coef[i] * b.coef[j]);
c.deg = c.degree();
return c;
}
public Polynomial compose(Polynomial b) {
Polynomial a = this;
Polynomial c = new Polynomial(0, 0);
for (int i = a.deg; i &gt;= 0; i--) {
Polynomial term = new Polynomial(a.coef[i], 0);
c = term.plus(b.times(c));
}
return c;
}
public boolean eq(Polynomial b) {
Polynomial a = this;
if (a.deg != b.deg) return false;
for (int i = a.deg; i &gt;= 0; i--)
if (a.coef[i] != b.coef[i]) return false;
return true;
}
public int evaluate(int x) {
int p = 0;
for (int i = deg; i &gt;= 0; i--)
p = coef[i] + (x * p);
return p;
}
public Polynomial differentiate() {
if (deg == 0) return new Polynomial(0, 0);
Polynomial deriv = new Polynomial(0, deg - 1);
deriv.deg = deg - 1;
for (int i = 0; i &lt; deg; i++)
deriv.coef[i] = (i + 1) * coef[i + 1];
return deriv;
}
public String toString() {
if (deg == 0) return "" + coef[0];
if (deg == 1) return coef[1] + "x + " + coef[0];
String s = coef[deg] + "x^" + deg;
for (int i = deg-1; i &gt;= 0; i--) {
if (coef[i] == 0) continue;
else if (coef[i] &gt; 0) s = s + " + " + ( coef[i]);
else if (coef[i] &lt; 0) s = s + " - " + (-coef[i]);
if (i == 1) s = s + "x";
else if (i &gt; 1) s = s + "x^" + i;
}
return s;
}
public static void main(String[] args) {
Polynomial zero = new Polynomial(0, 0);
Polynomial p1 = new Polynomial(4, 3);
Polynomial p2 = new Polynomial(3, 2);
Polynomial p3 = new Polynomial(1, 0);
Polynomial p4 = new Polynomial(2, 1);
Polynomial p = p1.plus(p2).plus(p3).plus(p4);
Polynomial q1 = new Polynomial(3, 2);
Polynomial q2 = new Polynomial(5, 0);
Polynomial q = q1.plus(q2);
Polynomial r = p.plus(q);
Polynomial s = p.times(q);
Polynomial t = p.compose(q);
System.out.println("zero(x) = " + zero);
System.out.println("p(x) = " + p);
System.out.println("q(x) = " + q);
System.out.println("p(x) + q(x) = " + r);
System.out.println("p(x) * q(x) = " + s);
System.out.println("p(q(x)) = " + t);
System.out.println("0 - p(x) = " + zero.minus(p));
System.out.println("p(3) = " + p.evaluate(3));
System.out.println("p'(x) = " + p.differentiate());
System.out.println("p''(x) = " + p.differentiate().differentiate());
}
}
|
|
|
|
|
It is unlikely that anyone will have the time or inclination to do this for you. Perhaps if you explained what problem you are trying to solve someone may be able to make some useful suggestions.
[edit]Having looked again I think if you changed System.out.println to printf statements (and added \n character at the end of each format string) it may well compile.[/edit]
The best things in life are not things.
|
|
|
|
|
Hi everyone im getting the following error message when i try to send a SOAP request. does anyone know how to fix it. im using SAAJ0537.
java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
|
|
|
|
|
Are the cleint and server both using the same SOAP message versions?
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
Have a bit more patience with newbies. Of course some of them act dumb -- they're often *students*, for heaven's sake. -- (Terry Pratchett, alt.fan.pratchett)
|
|
|
|