aspose file tools*
The moose likes Beginning Java and the fly likes please view this: java questions!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please view this: java questions!!!" Watch "please view this: java questions!!!" New topic
Author

please view this: java questions!!!

Jerome Laggad
Greenhorn

Joined: Mar 05, 2004
Posts: 4
hello to all Java Aficionado out there...
I just want to ask help from you. This are my java questions:
1. What is the difference between "class" and "object"?
2. Can we write java programs in non-OO way?
3. Can we make "private" the "toString()" method in constructor?
3. What is the difference between abstract class and interface? Why use abstract class and interface?
4. What is "Encapsulation" in SQL?
5. Can we use the keyword "strictfp" as modifier to classes, variables, or methods?
6. Can we use "private" as access level to constructor?
7. What is primitive data tpye?
Gjorgi Var
Ranch Hand

Joined: Feb 24, 2004
Posts: 85
As far as the first two questions are concerned:
1. Class is a blueprint for the object, and objects are instances of a class. If you have ever seen "Full Metal Jacket", recall that scene when future marines go to bed with their rifles, saying:"THIS IS MY RIFLE! THERE ARE MANY LIKE IT, BUT THIS ONE IS MINE!!!". "Rifle" is a class, "my rifle" is the object of the class "rifle". There are many instances of "rifle"("THERE ARE MANY LIKE IT,..."), but that one is a special ("...BUT THIS ONE IS MINE!"), sets apart from others, is unique instance... every object is a unique instance of a class...
2. You can absolutely proceed with no-OO spaghetti cooking in Java, no problem... in that case forget about reusability of your code, encapsulation, inheritance...
As far as the other questions are concerned, I think that there are people far more proficient in Java than me...
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

Originally posted by Jerome Laggad:
hello to all Java Aficionado out there...
3. Can we make "private" the "toString()" method in constructor?

Not sure what you are asking here? If you onlymean if you can make toString() method private, the answer is NO; as overriding requires you to make methd more public and less restrictive acces modifier is not allowed.

4. What is "Encapsulation" in SQL?

I am also interested in knowing the answer.
Regarding other answers, refer to any basic Java book. Thinking in Jaa might be a god idea.
HTH,
- Manish
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Beginners forum....


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Deepesh Makkar
Greenhorn

Joined: Apr 19, 2004
Posts: 1
Originally posted by Jerome Laggad:
hello to all Java Aficionado out there...
I just want to ask help from you. This are my java questions:
1. What is the difference between "class" and "object"?
2. Can we write java programs in non-OO way?
3. Can we make "private" the "toString()" method in constructor?
3. What is the difference between abstract class and interface? Why use abstract class and interface?
4. What is "Encapsulation" in SQL?
5. Can we use the keyword "strictfp" as modifier to classes, variables, or methods?
6. Can we use "private" as access level to constructor?
7. What is primitive data tpye?

Answer to 6th Question
V can ofcoz use private as access specifier to constructor, but v wont b able to create an object of such a class from outside the class itself. This is wat is done in Singleton pattern
7 Question:
primitive data types r data types which dont have associated classes with them and u cant create objects of such data types(such as int) but we can of coz use Wrapper classes to wrap them to objects
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
Answer to 6th Question
V can ofcoz use private as access specifier to constructor, but v wont b able to create an object of such a class from outside the class itself. This is wat is done in Singleton pattern
7 Question:
primitive data types r data types which dont have associated classes with them and u cant create objects of such data types(such as int) but we can of coz use Wrapper classes to wrap them to objects

I mean the writer of this statement no offense, but moderators, for the mental health of forum users, isn't there some way to censure such bastardization of the English language?
"V can ofcoz"
u,(v?),coz,b,wat,r,dont,cant.
I had to cringe multiple times while reading that post, and is that fair to a loyal forum attender? Coz doesn't even sound like a short version of becuase, at least say cus.
I try to keep my linguistic purism in check, and I'm all for a completely open forum to all walks of life, but can't moderators encourage a certain level of common decency?
While I'm on such a tirade,
"please view this" makes no sense as a subject (afraid I'll just ask the thread on a date?), and neither does "java" (this is a java forum). Thus, if you feel like giving as nebulous of a name as possible, leave it at "questions." I'll even let you keep your exlamation points.
Tirade over. Excuse me, I've had a bad day.
[ April 19, 2004: Message edited by: Joseph George ]

I've heard it takes forever to grow a woman from the ground
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

but v wont b able

It's so uncool.
Only children around there?
I agree with Joseph G.!
I'm no native english speaking person, and have difficulties reading such bzows�ief.
There are enough people, writing a more poor english than me, and I guess they will suffer from these cryptic engliz more than me.
It should be an issue for the nettiquette.
---
to the questions:
No. 5: No. What shall that be - strictfp?
No. 7: In my opinion, the only primitive datatype is boolean, but I'm not sure about that.
[ April 20, 2004: Message edited by: Stefan Wagner ]
[ April 20, 2004: Message edited by: Stefan Wagner ]

http://home.arcor.de/hirnstrom/bewerbung
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
nah, chars, ints, longs, floats, doubles, bytes... all primative. if you don't say
<blank> thing = new <blank>(), it's primative.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Joseph - I see, you didn't work too much with ints, chars etc.
They aren't so primitiv as they look like...
int a, b:
a > 0;
b > 0;
a+b < 0;
Tim West
Ranch Hand

Joined: Mar 15, 2004
Posts: 539
JLS Section 4.2 says that a primitive is, as Joseph says, one of boolean, int, byte, char, long, short, float, double.
-Tim
Nick George
Ranch Hand

Joined: Apr 04, 2004
Posts: 815
short... that's a good one, i forgot about that one
stefan, that code doesn't make any sense. just thought i'd throw that out there
[ April 21, 2004: Message edited by: Joseph George ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: please view this: java questions!!!