how to find special charcter from a string in java

String theInput = “wipro india(MAA)”;

char[] ch=theInput.toCharArray();
for(int i=0;i<ch.length;i++){
if(ch[i]=='[‘ || ch[i]=='{‘ || ch[i]=='(‘)


List overriding objects in java

What you add to the list is not an instance, rather a reference to an instance. So, at the end, all the references in the list is referring to the same instance. That would mean that, the change you make to your instance using any reference, will be reflected for all the references you added earlier to the list.

The solution would be to create a new Sms instance each time you add a reference to it in the list. That you would have to do it in the for loop.

for(int j = 0; j < group.getContatos().size(); j++){
    Sms sms = new Sms();
    listSms.add(sms);//Here he override all the list sms.number to last one added

Can you explain to me how the Indian government works?

To understand the beauty of our government system, I shall have to start from basics. Please don’t mind me if you already know some/all these things.

The Indian Government can be divided in the following ways, with respect to various perspectives –

1) Federalism

This means that the country has two governments – Centre and State.

India is a Union of Individual States, but with a strong centre. This means, that the Central government has more powers than the state government. There are some more conditions like states cannot secede from the Union, the Centre can bifurcate, join or create more states etc.

The Parliament consists of –

Lok Sabha – Council of People – The members represent the people of the country and are voted by all voters in the whole country.
Rajya Sabha – Council of States – The members represent the various states at the centre and are voted in by the states’ legislature.

As you can see, at the centre, both the states and the people are represented. The members are called “Members of Parliament” (MP)

The Governor is the representative of the Centre at the state.

The States also have a legislature, which is called the Assembly, which are voted in by the people too and the members are called MLAs.

Some states have an extra Council whose members are called MLCs.

The states always fight for more autonomy and the centre always tries for more control.

2) Separation of Powers

The Government can again be divided into three parts –

a) Legislature – They understand the grievances of the public and make policies to eradicate them.

b) Executive – The policies made by the Legislature are executed by this body.

c) Judiciary – If any problem arises, it solves the issue.

All MPs, MLAs, Panchayat members etc., are legislative members at their respective levels. They make laws/policies on various issues and subjects.

MPs – Union List – SCHEDULE (This has the list on which the centre and the state can make laws)
MLAs – State List

The Executive consists of Ministers and their Ministries. Eg., Home Ministry, Finance Ministry etc.

The Ministers are taken from the MPs itself, so that they show collective responsibility to the Legislature. Whatever actions they do, they are responsible to the Parliament. Their actions are discussed and debated upon during the Question Hour parliamentary sessions.

The CAG who is the governmental auditor audits all the accounts of the Executive and reports any misdeeds or scams.

3) Executive

a) Permanent Executive (Babu)  

This is the government body which consists of all public servants – IAS, IPS, IFS, Directors, Staff, Departmental heads, Sectional officers, Tehsildars, Revenue officers, Secretaries, Peons and every other person you see in a governmental office.

They have a permanent job and their work is to implement/execute the policies decided by the Legislature.

They are selected after writing governmental examinations like UPSC, SSC, UPPSC etc. They are the brain behind the governmental machinery.

b) Political Executive (Neta)

These are the political heads, i.e. Ministers. They know what the people want, as they have been voted in by the people. Their life is only for 5 years, after which the people vote again.

They can be anyone who understand people’s needs. They need not be educated nor be an expert.

Any particular Ministry has two heads, Eg., Home Ministry –
a) Home Secretary – Permanent Executive
b) Home Minister – Political Executive

It is a rule that all Departments should be headed by a “Civilian Political Head” who is voted in to power by the people. People’s selection is mandatory even if it is temporary.

So, the Minister is the boss of the Secretary and the whole Ministry. This helps in decreasing the power of the bureaucracy because they are permanent in nature and only then the country would not become a despot.

The bureaucrats always fight for more autonomy and the politicians always try to exhibit morecontrol.

So, now, how does the whole system work?

It all starts with the Common Man. We need to understand that the common man is supreme in the country, and everyone works for him.

Step 1 – Common Man says he is hungry and he has no cash for food. He cries.
Step 2 – Someone says, Ill provide you food. I understand your problems well.
Step 3 – The common man trusts this man, and votes him into the legislature. (MP or MLA)
Step 4 – The MP, who understands the problem asks the Executive to provide food for the Man.
Step 5 – The Minister who is in charge of the Ministry which provides food, tells it to the permanent executive (Secretary).

This is where Aspirations change into Executions. The Minister is also an MP, let us assume that he is illiterate, but he understands what the people need. The Permanent Executive (IAS, IPS etc.) are intellectuals but they might not know what the common man needs right now.

So, here all officials sit, discuss and then make a policy/bill and then will give it to the Minister.

Step 6 – The Minister will take the prepared bill, eg. National Food Security Act, and will table it in the Parliament, saying this can be done.

Step 7 – The Legislature, MPs, go through the bill, and if they like it, they vote and will make it into a Law.

Step 8 – Now, according to the Law, Food must be given to the poor common man.

Step 9 – The Executive comes back into picture here, where the actual “implementation” is done – Procurement of food grains, construct godowns, transport, have good roads for that, then establish PDS systems(Ration shops), give the poor man a ration card, and finally give him the food grains.

Step 10 – The common man is happy, the MP/MLA will tell him that he made it happen and if you have any more issues, do vote for him again!

To ensure that the food grains are reached, the Minister ensures that the bureaucracy works efficiently.

But, usually corruption, lethargy, inefficiency creeps in.

This is how a typical Government works.

Media, newspapers, critics, CAG, RTI, audits will keep reviewing the work done by the Government.