Vijayendra V Rao

Ranch Hand
+ Follow
since Jul 04, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vijayendra V Rao

Originally posted by Clarice Doe:


It encapsulates state and behaviour. But, what effect does that has on whether Java is OO or not.



Good stuff! A class represents the state and behavior of "something". Now what is that "something"? When we design an application, we try to split up the problem domain into a conceptual set of objects and then we write classes that represent the state and behavior of these objects within the application scope. Even to start an application you will need an object, which would be the starting point. Even this is an object from where your application kicks off.

Thats the reason why I put it up in the form of a question itself. There is no way you can write a non-object-oriented program, atleast as far as I know, in Java. Ofcourse you can have an interface or an abstract class. But what is the purpose of it?! Where will you use it?! What does it represent?! It isn't even going to have a context in such a case.

I dunno how far I have been able to express myself. But if you still have questions then shoot back
16 years ago
Try this piece of code:



I assume you are also aware that when you don't specify the delimiting characters in the StringTokenizer constructor, it assumes the default delimiters.

If you still run into problems post it again

Vijay
16 years ago

Originally posted by Vallabhaneni Suresh Kumar:
Why Java is not fully object oriented language?



Show me a program without a single class in it first and then I will answer your question! What does a class encapsulate?! Think!!!
16 years ago
If the String that you are trying to parse has a space, then it throws this Exception. Try another approach.
17 years ago

Originally posted by Mark Rem:
hey, what would be somme operations for this function? Can anyone start me off?



Make your question more clear please.
17 years ago
The decision of extending a class should be based on whether the "specific" class that you are talking about would make any design sense by being made as a sub-class of the other class (which has those methods). However, if you are thinking of inheritance just in order to use those methods, then that would be just a "quick-and-dirty" inheritance. Simple thing...don't go for it because you yourself will get confused when you are trying to make sense out of the whole code at a later point (not to mention your fellow programmers ;-) )

If both the classes have no hierarchical sense, then go with the second method. If you have declared the methods to be static, then they will neither be stored in the heap nor the stack nor the constant storage...they go into a different type of storage, in the RAM, called "static storage". So I don't think this approach will be a hit on the performance.
17 years ago
The two words that you have used have no connection with Java as far as I can think of.

If you really are keen on knowing more on Java, then this is the best place for you.
17 years ago
Marker interfaces (or tagging interfaces, as they are normally known) are basically used to "signal" something to the users of your classes. You would better understand with an example. Consider the method :



Now, this method may either recieve a LinkedList or it may recieve an ArrayList, or even some new List type that you are not even aware of! You never know with what type of a List this method will be called. However, you want to make sure that your sorter() method is as optimized as possible. How would you do this?

You might be aware that there is a tagging interface in the collections library called RandomAccess. The ArrayList implements this interface. Why? Its just to signal that random access for that particular container is going to be efficient. Random access in an ArrayList is efficient and the same on a LinkedList is definitely not. So, you can use this tag to your advantage in your sorter() method and modify the method as follows:



Does this make the concept clear?
17 years ago
There is no such a thing as "versions" of class files. If you change the source code and re-compile it, then you have earsed the old class file and replaced it with a new one.
17 years ago


A better way would be:

17 years ago
JSP


A better way would be:

17 years ago
If you are looking for a good container for sorting purposes, I suggest you go with ArrayList. Most of the sorting algorithms access elements on the container that they act on in a non-linear manner. So if the sorting code makes a call to something like:

myLinkedList.get(i);

then this will always start the iteration from the beginning of the LinkedList (unless i > myLinkedList.size()/2) unlike the ArrayList. If your container is large with many Objects in it, then this will turn out to be a performance killer! So, if you are looking for a sorting container, then go with ArrayList.

This is one of the reasons, if you see, ArrayList implements the RandomAccess interface and LinkedList does not.
17 years ago

Originally posted by John Cochrane:
Was this intentional? I can't find a chapter 5 (I'm not that familiar with the java docs).



Oh I am very sorry I forgot to mention where you need to navigate to. Let me provide the direct link to that page:

http://java.sun.com/docs/books/jls/second_edition/html/jTOC.doc.html

You get this page after a series of navigations from the API pages
17 years ago
will it? Why don't you try the following piece of code?
truncated. If you wish to have a good deal of insight into these conversions, then I would suggest you look Language Specifications. So if you look through the language specs, chapter 5 of it will explain stuff in a very clear manner. Hope this helps
17 years ago
Have you evaluated Semaphores? You can have very efficient resource-allocation control by using a single Sempahore object to control the resources.

Now coming to your "satisfaction for each order"...this depends upon how much of your code goes through synchronization and how big your run() method of the thread will be.
17 years ago