Can a library Class be declared as a member of a class in Java?
969657
Is the library class a final class? If it is not, suggest you create a new class that extend that library class and include this new class as an inner class in your class. \nCheck out 'Inner Class' for Java, that allows a class definition to be placed inside  another class.
338060
An instance in Java is referred to the Memory block where the Object variables are placed on the HEAP. \n\nSuppose we have the following Object\n\nClass obj{\nprivate int a;\nprivate int b;\n\npublic int Sum(){\nreturn a+b;\n}\n\n}\n\nnow this Objecet (obj) is instanced as follows\n\npuiblic static void main(String argv[]){\nobj myObj = new obj(); //Creates an instance of obj on the heap\nint a =myObj.Sum();//Call to the sum method of the obj class\n}\n\nWhen a class in instantiated all the PUBLIC methods are in scope of the calling class
172063
http://www.thefreecountry.com/compilers/cpp.shtml
1015124
The result will be false if the AbstractObject is an abstract class!\n\nThe result will be true if AbstractObject is a concrete class
148785
ignacionr2 has the most correct response to this question.  The standard C++ library has a 'string' type in the standard ('std') namespace that allows you to declare and initialize an abstract string type.\n\nNote, the header files for the standard C++ library no longer have the ".h" extension on them.  So for I/O streams, you'd use: "#include <iostream>" and for strings, you'd use: "#include <string>".\n\nTo declare instances of a string, you could use:\n\nstd::string myString = "string one";\n\nor\n\nstd::string myString("string two");\n\nYou can add a "using std::string;" to your local scope as a shortcut to avoid typing "std::" to qualify the standard string's namespace.
162412
System.out is indeed an instance of java.io.PrintStream.  println() is a member function of java.io.PrintStream, but you're calling println() you're actually working with java.lang.System.out (which is a PrintStream, but Java already knows that, so you don't need to import PrintStream to show it).  \n\nPerhaps it would be helpful to you to understand what Java actually does with import statements.  They are *not* used to give the program access to different pieces of code.  It is tempting (especially for C/C++ programmers) to think that import statements are a mechanism for including other code files, but they are really more like C++ "using namespace" statements.  Java import statements have exactly one function: to save you typing.  You can take any program and remove all the import statements without breaking it, so long as you're willing to use the full names of all of your classes.\n\nJava's technique for deciding which files it needs to use is rather interesting.  Since all public classes are in files of the same name, Java can easily find any class by looking for a file named "name.java" (or name.class if compiled).  The dots between the package names are used to separate directories.\n\nOf course, if you wanted to pass something System.out as an argument, you'd need to use java.io.PrintStream as the parameter type (or import java.io.PrintStream).
270512
Would be something roughly like this:\n\n#include <cstdlib>\n#include <iostream>\n#include <fstream>\n#include <string>\n\nusing namespace std;\n\n\n\nint main(void)\n{\n    string  T;\n    ifstream inf;\n    ofstream outf;\n    inf.open("myfile.txt", ios::in);\n    outf.open("YourFile.txt", ios::out);\n    while(!inf.eof()){\n        getline(inf, T, '&#92;n');\n        outf << T << "&#92;n";\n        }\n    inf.close(); \n    outf.close();\n    system("PAUSE");\n    return EXIT_SUCCESS;\n}\n\nI think.
850733
I don't think we are going to do your homework for 10 points. If you have a very SPECIFIC question on how a library routine or feature in Java works, we can help you.
933539
What do you mean by java class?
24164
I think you are asking in C++. \nYes you can do it. \n\nlet the structure be like this\nstruct base{\n int x;\n};\nHere I want to add the member x is a public this is the difference between class and structure. \n\nConsider the following code segment. \n#include <iostream>\nstruct base{\n        int i;\n};\nstruct inhe : base{\n        int j;\n};\n\nmain(){\n        inhe ob;\n        ob.i=10;\n        ob.j=12;\n        cout<<ob.i<<endl;\n        cout<<ob.j<<endl;\n        return 0;\n}\nOutput :\n10\n12
89402
Code:\npublic class BTNode \n{\n    private Object data;\n    private BTNode left, right;\n    public BTNode(Object initialData, BTNode initialLeft, BTNode initialRight)\n        { \n            data = initialData;\n            left = initialLeft;\n            right = initialRight;\n        }\n    public BTNode()\n            { this(null, null, null); }\n    \n    public BTNode(Object newdata)\n            { this(newdata, null, null); }\n    \n    //NODE methods\n    public Object getData()                     //return and set data in node\n            {return data;}\n    \n    public void setData(Object data)\n            {this.data = data; }\n    \n    public BTNode getLeft()                 //return and set left child\n            {return left; }\n    \n    public void setLeft(BTNode left)\n            {this.left = left; }\n    \n    public BTNode getRight()                //return and set right child\n            {return right; }\n    \n    public void setRight(BTNode right)\n            {this.right = right; }\n    \n    public boolean isLeaf()                 //return true if this is leaf node\n            {return (left == null)&&(right == null); }\n \n// TREE Methods - for tree starting at this node\n// get specific data from a tree\n    \n        public Object getLeftmostData()\n        { if(left == null)\n               return data;\n          else \n              return left.getLeftmostData(); }\n        \n        public Object getRightmostData()\n              { if(right == null)\n               return data;\n          else \n              return right.getRightmostData(); }\n// print data in a tree\n        public void inorderPrint()\n                {\n                    if (left != null)\n                        left.inorderPrint( );\n                    System.out.print(data+"&#92;t");\n                    if (right != null)\n                        right.inorderPrint( ); }\n        \n        public void preorderPrint()\n                {\n                    System.out.print(data+"&#92;t");\n                    if (left != null)\n                        left.preorderPrint( );\n                    if (right != null)\n                        right.preorderPrint( ); }\n        \n        public void postorderPrint()\n                {\n                    if (left != null)\n                        left.postorderPrint( );\n                    if (right != null)\n                        right.postorderPrint( );\n                    System.out.print(data+"&#92;t"); }\n        \n// pretty print a tree\n        //public void print(int depth);\n \n//Interface for Nodes in Binary Tree (3)\n//removing nodes from a tree\n//returns reference to tree after removal of node\n        public BTNode removeLeftmost()\n              {\n                    if (left == null)                               // we are as deep as we can get\n                        return right;                               // remove this node by returning right subt ree\n                    else\n                        {                                           // keep going down recursively\n                            left = left.removeLeftmost( );\n                                                                    // when done, return node that act ivated this\n                                                                    // method as root of t ree\n                            return this; }}\n        \n        public BTNode removeRightmost()\n        {\n                    if (right == null)                               // we are as deep as we can get\n                        return left;                               // remove this node by returning left subt ree\n                    else\n                        {                                           // keep going down recursively\n                            right = right.removeRightmost( );\n
338547
Seems like you have a type-o just above line 13.  in your declaration of  the Matrix class.  should be a single c in the word 'class'.\n\nIf you aren't already, you may want to consider using an IDE like netbeans which will catch simple  syntax errors like this for you before compiling.\n\nhope this helps.
897144
I'm going to assume you need to design a Textbook class to represent the books on the shelf.\n\nYou need to design the Shelf class like this:\n\npublic class Shelf\n{\nprivate Textbook[] books;\n\n// constructor\npublic Shelf(int numBooks)\n{\n// initialize the books array with length=numBooks\nbooks = new Textbook[numBooks];\n}\n\n// adds a book to the shelf at position p\npublic void addABook(Textbook tb, int p)\n{\nbooks[p] = tb;\n}\n\n// get a book from the shelf at position p\npublic Textbook getABook(int p)\n{\nif (books[p] == null)\nthrow new BookNotFoundException();\nelse\nreturn books[p];\n}\n\n// get a list of all textbooks on the shelf\npublic String getAList()\n{\n// return string, starts out empty\nString list = "";\n// walk through books array\n// add each book's title to the return String\nfor (int i = 0; i < books.length(); i++)\n{\nif(books[i] != null)  // if this spot on shelf is not empty\nlist += books[i].getTitle() + "&#92;n";\n}\nreturn list;\n}\n}\n\nThe IndexOutOfBoundsException is thrown automatically when an invalid array index is used, but you can explicitly throw the exception the same way I threw the BookNotFoundException.\n\nYou still need to design a Textbook class with a constructor that lets you enter its title and a getTitle() method that returns the title in a String.  And you still need to define the BookNotFoundException, which I haven't done.\n\nYou might want to double check my syntax on the exception throwing; not sure if I did it entirely right.  Good luck.
29500
I think c is true becuse a varible name can not contain any thing other than lettera and digit if you add _ in letters.\nBut a class may not have constructor when default constructor will be used.
399986
This link might help\nhttp://ekhtml.sourceforge.net/\n\nRequired classes already exist in Java, and most probably in C++ as well.
681886
Do not think it is declared yet. Plz check http://result.uniraj.ernet.in/ for the same. II & III are declared but not I
254178
With GCC compiler (used by Dev-++) you can write:\n\nsystem("cls");