Megha SR 0 Newbie Poster

helo everyone......... could anyone of you please explain me the concept of ARRAYS.
another doubt.........can anyone of you just give e the basic lgic ofbinary search, linear search, bubble sorting an selection sorting!! specially binary search and linear serch the concept i have not understod proprly!! and a smal program to illustrate this pleae!!!

Megha SR 0 Newbie Poster

what is the difference between call by value and call by refers=ence? can you please give an example to illustrate it?

Megha SR 0 Newbie Poster

you can use switch case.its a long method.

Megha SR 0 Newbie Poster

thanks for that help. can you give me an example through a small program?i will understand it better with an example..waiting for your reply!

Megha SR 0 Newbie Poster

rice with a delicious curry! yummy!

Megha SR 0 Newbie Poster

can anyone explain to me about what actually is a constructor?

Megha SR 0 Newbie Poster

what is a hashmap and how do i use it? please help me @JamesCherril

Megha SR 0 Newbie Poster

is animv09c a gaming software? how do i use it?

Megha SR 0 Newbie Poster

no a character is not a string. the reaseon is that a character is enclosed within single quotes whereas a string is enclosed within double quotes.

Megha SR 0 Newbie Poster

can i do any modification in my program? if so, where? can you please help?

Megha SR 0 Newbie Poster

abstraction is the act of representing essential features withi=out including the background details or explaination. so, abstraction is used for hiding the unnecessary or the unwanted data from being displayed. for example if you know about functions in java, the process of calling the sub function,etc is hidden from the user. in a normal class, all these processes are shown.

Megha SR 0 Newbie Poster

i am convetring the character to a string value by usu=ing the variable 'j'.

Megha SR 0 Newbie Poster

i think it is-- Character.parseChar()

NormR1 commented: Posted invalid code +0
Megha SR 0 Newbie Poster

hello. i have done the followinh program to convert a String value to a double value.when i am compiling this program, i get an error as"unclosed character literal in the 18th line.can anyone say what's the problem?

import java.io.*;
class strin
{
    public static String a(String s);
    {
        String j="";
        char a;
        int i;
        for(i=0;i<s.length();i++)
        {
            c=s.charAt(i);
            if(c==' ')
            {
                j=j+c;
            }
            switch(j)
            {
                case 'one':System.out.print("1");break;
                case 'two':System.out.print("2");break;
                case 'three':System.out.print("3");break;
                case 'four':System.out.print("4");break;
                case 'five':System.out.print("5");break;
                case 'six':System.out.print("6");break;
                case 'seven':System.out.print("7");break;
                case 'eight':System.out.print("8");break;
                case 'nine':System.out.print("9");break;
                case 'ten':System.out.print("10");break;
                case 'eleven':System.out.print("11");break;
                case 'twelve':System.out.print("12");break;
                case 'thirteen':System.out.print("13");break;
                case 'fourteen':System.out.print("14");break;
                case 'fifteen':System.out.print("15");break;
                case 'sixteen':System.out.print("16");break;
                case 'seventeen':System.out.print("17");break;
                case 'eigtheen':System.out.print("18");break;
                case 'ninteen':System.out.print("19");break;
                case 'twenty':System.out.print("2");break;
                case 'thirty':System.out.print("3");break;
                case 'fourty':System.out.print("4");break;
                case 'fifty':System.out.print("5");break;
                case 'sixty':System.out.print("6");break;
                case 'seventy':System.out.print("7");break;
                case 'eigthy':System.out.print("8");break;
                case 'ninty':System.out.print("9");break;
                case 'hundred':System.out.print("1");break;
                case 'and':System.out.print("");break;
                case 'dot':System.out.print(".");break;
                case 'point':System.out.print(".");break;
            }
        }
        return i;
    }
    public static void main()throws IOException
    {
        try
        {             
        String r;
        BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("enter a sentence to print it in numbers");
        r=x.readLnie();
        String h;
        str cl=new cl();
        h=cl.a(r);
    }
    catch(Exception e)
    {
        System.out.print(e);
    }
}
}
Megha SR 0 Newbie Poster

eg=
String s="Hai! Hello Java";//this is the input or sentence whose words are to be counted
int i,words=1;//variable words is used to count the number of words.
char c;//variable c is used to extract each character.
for(i=0;i<s.length();i++)
{
c=s.charAt(i);
if(c==' ')//space is counted to determine the number of words.
words++;//increases the number of words by one.
}
System.out.println("no. of words ="+words);
}

Megha SR 0 Newbie Poster

hello. i have just started learning functions in java. i have done the below program to find area of rectangle,triangle and square. it is a private class.

class calcu
    {
        void rectangle(int l,int b)
        {
            int area1;
            area1=l*b;
            System.out.println("area of rectangle = "+area1);
        }
        void triangle(double base,double h)
        {
            double area2;
            area2=(0.5)*base*h;
            System.out.println("area of trinagle = ="+area2);
        }
        void square(int len)
        {
            int area3;
            area3=len*len;
            System.out.println("area of square = ="+area3);
        }
        public static void main(int m,int n,double o,double p,int q)
        {
            int a,d;
            double c;
            calcu obj=new calcu();
            a=obj.rectangle(m,n);
            c=obj.triangle(o,p);
            d=obj.square(q);
        }}

when i compile this program, i get an error that "incompatible types-found void but expected int".can anyone say what mistake i have done?

Megha SR 0 Newbie Poster

thankyou coil for the answer

Megha SR 0 Newbie Poster

i have got a program to convert a double value to a string.
eg==INPUT= 3.65
OUTPUT=three point six five.
can anyone give the solution.

Megha SR 0 Newbie Poster

thankyou James for the help ill search in this site.

Megha SR 0 Newbie Poster

i am not understanding the concept of FUNCTIONS and HOW TO US EFUNCTIONS. the answers from google search and wikipedia are not useful to me! can u help?

Megha SR 0 Newbie Poster

guys........ can anybody help me in FUNCTRIONS?? i'm not able to understand it. can u show me examples also???????? pls:icon_confused: :cool:
pls reply............. thankyou.........:?:

Megha SR 0 Newbie Poster

ther's a simple program 4 tat. Here it is............
u can use this method if u hv finished String class

import java.io.*;
class split
{
public static void main()throws IOException
{
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
String a;
int i,j;
char c;
System.out.println("Enter a word to split the letters");
a=x.readLine();
for(i=0;i<a.length();i++)
{
c=a.charAt(i);
System.out.println(c);
}}}

Megha SR 0 Newbie Poster

can anyone solve this?
a b c d e d c b a
a b c d***d c b a
a b c*******c b a
a b***********b a
a***************a

NOTE: here '*' denotes space

Megha SR 0 Newbie Poster

class pattern
{
public static void main()
{
int i,j;
for(i=6;i>=1;i--)
{
for(j=1;j<=i;j++)
{
System.out.print(j);
}
System.out.println();
}}}