Bookmark Topic Watch Topic
  • New Topic

how to make fabric cutting example in java using wait,notify,synchronization  RSS feed

 
parveen mehta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator

 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please describe "fabric cutting example".
 
parveen mehta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Madhan Sundararajan Devaki wrote:Please describe "fabric cutting example".

we have to make a program which ask the user for the shape of fabric
and add it to the list machne instruction and machine instructions create instructions for that shape and give that shape to the another for make it...
thanks for respond me...
Sir i have one more problem abt volatile i av clear the concept of volatile in java bt dis is not working properly...like making a variable. volatile or not making any effect... can you tell me abt dis also...
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Report post to moderator
Are you expecting a CNC program using Java or are you expecting how this scenario should be modelled using OOP methodology?

Volatiles are best suited for primitive data types. An instance variable declared volatile ensures that the update operation on it is atomic.
 
parveen mehta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Madhan Sundararajan Devaki wrote:Are you expecting a CNC program using Java or are you expecting how this scenario should be modelled using OOP methodology?

Volatiles are best suited for primitive data types. An instance variable declared volatile ensures that the update operation on it is atomic.

Thanks sir for giving me your precious time... sir i want to know how this scenario should be modelled using OOP methodology.
Sir, actually i am refering book SCJP by kattht Sierra at where this example is introduced but there is not complete description about this.

Sir,Would you please tell me can we use private constructor outside the class in java? if your answer is yes then please give me example of it.
and about volatile if you give me example it would be better,i am not getting any difference between volatile and simple instance variable.
like if i make a program
class multi extends Thread
{
int x=0;
public void run()
{
x++;
System.out.print(x);
}
public static void main(String aa[])
{
multi m=new multi();
Thread t=new Thread(m);
Thread t1=new Thread(m);
t.start();
t1.start();
}
}
Then output is always 1 and 2 even if i make x volatile or not
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please ask one question at-a-time.

If you need to use OOP methodology, you need to do the following.
1. Identify the entities involved in the problem
2. Identify the actions that can be performed by each entity
3. Create classes representing the entities and methods representing the actions

Private constructors cannot be accessed outside a class, as it is private.

A variable marked "volatile" is also an instance variable.
An instance variable that is not marked volatile can be in an inconsistent state when multiple threads access/modify its value in-parallel.
However, an instance variable that is marked volatile will ensure that only one thread can successfully update its state, but, experts do not recommend using an instance variable marked volatile for this purpose.
The reason being, nowadays, the presence of java.util.concurrent.* packages in Java allow you to handle concurrent situations effectively.
 
parveen mehta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Madhan Sundararajan Devaki wrote:Please ask one question at-a-time.

If you need to use OOP methodology, you need to do the following.
1. Identify the entities involved in the problem
2. Identify the actions that can be performed by each entity
3. Create classes representing the entities and methods representing the actions

Private constructors cannot be accessed outside a class, as it is private.

A variable marked "volatile" is also an instance variable.
An instance variable that is not marked volatile can be in an inconsistent state when multiple threads access/modify its value in-parallel.
However, an instance variable that is marked volatile will ensure that only one thread can successfully update its state, but, experts do not recommend using an instance variable marked volatile for this purpose.
The reason being, nowadays, the presence of java.util.concurrent.* packages in Java allow you to handle concurrent situations effectively.

Thanks sir for guide me in future i wiil give you one question at a time... and thanks again for giving me your precious time.
 
parveen mehta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
parveen mehta wrote:
Madhan Sundararajan Devaki wrote:Please ask one question at-a-time.

If you need to use OOP methodology, you need to do the following.
1. Identify the entities involved in the problem
2. Identify the actions that can be performed by each entity
3. Create classes representing the entities and methods representing the actions

Private constructors cannot be accessed outside a class, as it is private.

A variable marked "volatile" is also an instance variable.
An instance variable that is not marked volatile can be in an inconsistent state when multiple threads access/modify its value in-parallel.
However, an instance variable that is marked volatile will ensure that only one thread can successfully update its state, but, experts do not recommend using an instance variable marked volatile for this purpose.
The reason being, nowadays, the presence of java.util.concurrent.* packages in Java allow you to handle concurrent situations effectively.

Thanks sir for guide me in future i wiil give you one question at a time... and thanks again for giving me your precious time.

Sir can you tell me what is the purpose of reflection in java?
 
Henry Wong
author
Sheriff
Posts: 22853
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
parveen mehta wrote:
parveen mehta wrote:
Thanks sir for guide me in future i wiil give you one question at a time... and thanks again for giving me your precious time.

Sir can you tell me what is the purpose of reflection in java?


Just to be clear -- one question at a time means using different topics. Asking it in the same topic just makes a mess of everything, as everyone has to read through the previous question to even know that there is a new question.

On top of that this new question is not even threads related.

Henry
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!