QueryCAT Logo
Search 5,000,000+ questions and answers.

Frequently Asked Questions

What is the Java equivalent of C++ friend"?

Java Programmer's FAQ
The keyword "friend" in C++ is a hack to allow a piece of code to access the private member declarations of another class. In Java, you would do this by labelling, not the friend, but the private members. Instead of making them private, make them protected. Classes in the same package have automatic "friendship" in that they can access each other's protected fields. Yes, only it's better and simpler to use in Java. It's called the Java Generic Library.

Sect. 17) Does Java have the equivalent of "const" arguments in C and C++?

Java Programmer's FAQ - Part D
Java 1.1 adds the ability to use the "final" keyword to make arguments constant. When used to qualify a reference type, however, this keyword indicates that the reference is constant, not that the object or array referred to is constant. For example, the following Java code: void foo(final MyClass c, final int a[]) { c.

Sect. 17) What is the equivalent of C++'s "friend"?

Java Programmer's FAQ - Part D
The keyword "friend" in C++ is a hack to allow a piece of code to access the private member declarations of another class. In the Java programming language, you would do this by labelling, not the friend, but the private members. Instead of making them private, make them either protected or package (no keyword) or public. package (specified by omitting other keywords) is the default level of protection; members are accessible from any class within the package of the containing class.

Does C have an equivalent to Pascal's with statement?

Structures, Unions, and Enumerations
The rule (see question 6.3) that causes array references to ''decay'' into pointers is a special case which applies only to arrays, and reflects their ''second class'' status in C. (An analogous rule applies to functions.) Structures, however, are first class objects: when you mention a structure, you get the entire structure. This program works correctly, but it dumps core after it finishes. Why? struct list { char *item; struct list *next; } /* Here is the main program. */ main(argc, argv) { .

Do I need to know C++ before Java?

Java and C++ are meant for two different purposes. Of course they are two widely used OOPLs (Object Oriented Programming Languages). Knowing one is not a prerequisite to another. However, C is the prerequisite to both these language as these two use the same control structures of C.

How to communicate between Java and C++?

FAQ on C/C++/Unix by Roseanne Zhang, Java Programmer Certifi...
Socket: you can pass any information from C/C++ to Java or Java to C/C++. However, if you want to call each other's method/function. You will find out you need to you need to marshal and unmarshal your methods by yourself. You're creating your own protocols. You'd be better off use CORBA. Corba is just for what you want, you use IDL to write your the function or methods, then compile it to C/C++ and Java to use.

Why is Kannel written in C and not in Java?

Kannel: Open Source WAP and SMS Gateway
The Kannel team does not have a strong expertise in Java, so re-implementing Kannel in Java would require us to spend weeks learning the language well. The re-implementation work itself would also take some months. There is no point in doing this.

Why do you not teach C++ or JAVA?

FAQ
Even though we have on staff several teachers who have computer science/programming backgrounds, we feel that these are not appropriate languages to teach the concepts of programming and have kids create a project on their own that they can be proud of. The software we use have been given numerous awards by educational technology magazines and are chosen as to their merit to teach programming.

How can I interface to C / Java?

scheme-faq-standards
Most Schemes support a so-called "foreign function interface" (FFI) to the native language (i.e. the language in which the Scheme interpreter/compiler was implemented). FFIs provide the following features: Calling native code from Scheme The most basic FFIs allow you to write functions/methods following certain conventions and then call these native functions/methods from Scheme.

What is the difference between Java and C++?

Java Language FAQs
Java is a roubust and platform independent language which is used to develop business and internet applications. Function and class Templates. Java has Generics (which are simlar to Templates though not same) in version 5.0

Will we ever get Java?

Answers to Some Frequent webtv.users Questions
According to posts in webtv.users from Steve Perlman, ex-president of WebTV, WebTV has been working to provide a form of Personal Java for the WebTV Plus terminal (and possibly the new Classics and Dishplayer, but nothing was said specifically about them as they were not announced products at the time of the posts)?there is no guarantee this will happen. For the full text of Steve's posts, click here.

How to define arrays in Java, C/C++, and C#? Are they different?

JavaChina: SCJP Questions & Answers by Roseanne Zhang (8...
float[] only applies to the first variable of the right variable list. float[] f1d_a, f1, f1d_b[]; // is equivalent to float f1d_a[]; // or float[] f1d_a; float f1; // f1 is not an array float f1d_b[]; // or float[] f1d_b; In Java, better, but still confusing!! float[] applies to all variable of the right variable list.

Is it possible to invoke GCJ compiled Java code from a C++ application?

The GCJ FAQ - GNU Project - Free Software Foundation (FSF)
What license is used for libgcj? libgcj is distributed under the GPL, with the 'libgcc exception'. This means that linking with libgcj does not by itself cause your program to fall under the GPL. See LIBGCJ_LICENSE in the source tree for more details. How can I contribute to libgcj? You can send simple bug fixes in as patches. Please follow the GCC guidelines for submitting patches. For more complex changes, you must sign copyright over to the Free Software Foundation.

Why is MTL written in C++ and not Java?

Matrix Template Library Frequently Asked Questions
The Java language was developed for certain particular purposes. Scientific computing was not one of those purposes. Generic programming was not one of those purposes. To offer sufficient performance for scientific computing, Java must be compiled to native object code, not byte code. To provide genericity, the Java language would have to be changed to include operator overloading and templates. Hmm. Templates, overloading, compilation to native object code.

Can C++ have inner class similar to Java?

FAQ on C/C++/Unix by Roseanne Zhang, Java Programmer Certifi...
They are actually not the same thing! See the following sample code, and read the comments inside, please! #include <iostream> using namespace std; class Outer { public: class Nested { public: Nested(int a):value(a){} void printValue() { cout << "Nested class value: " << value << endl; } private: int value; }; private: Nested *b; }; int main(){ Outer a; // It is not the same as Java Inner class, but the nested top level class // It should be marked as static in Java to be.

What are Perl, C++, ASP, PHP and Java?

DNS Hosting UK
These are all programming languages, that can be run on a web server. Programs or scripts written in these languages, can provide your web site with additional functionality and higher levels of dynamic content.

Is goto statement supported in C#? How about Java?

Mail Test
Gotos are supported in C#to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality. No fall-throughs allowed. Unlike the C++ switch statement, C# does not support an explicit fall through from one case label to another. If you want, you can use goto a switch-case, or goto default.
More Questions >>

© Copyright 2007-2012 QueryCAT
About • Webmasters • Contact