Strings in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ysrinu15
    New Member
    • Jul 2007
    • 1

    #1

    Strings in java

    Hi all ,i have somedoubt ,
    1)how can say one class is an immutable,and what r basic rules that class should follow?
    2)linked list problem?
    how do find which is single linked list and which circular liked list,and what r the basic rules should strictly find the list?
    3)one class A
    {
    a{}
    }
    another class B
    {b{}
    }
    another class C
    {
    c c1=new c();
    // [using class C object , HOWcan call the method of cllass A ,class B }
    ///i do not answer .
    //what base those method call on Class C object?
    //
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by ysrinu15
    Hi all ,i have somedoubt ,
    1)how can say one class is an immutable,and what r basic rules that class should follow?
    2)linked list problem?
    how do find which is single linked list and which circular liked list,and what r the basic rules should strictly find the list?
    3)one class A
    {
    a{}
    }
    another class B
    {b{}
    }
    another class C
    {
    c c1=new c();
    // [using class C object , HOWcan call the method of cllass A ,class B }
    ///i do not answer .
    //what base those method call on Class C object?
    //
    1.) Do you know what immutability means then? Just write a class and use Java modifiers to make it impossible to change the variables in that class. Hint : final, and private are handy here
    2.) You cannot call a method in class A from class C without an instance of either A or B directly. To call a super class method, the keyword is ...<drums>... super.

    Comment

    • madhoriya22
      Contributor
      • Jul 2007
      • 251

      #3
      Originally posted by ysrinu15
      Hi all ,i have somedoubt ,
      1)how can say one class is an immutable,and what r basic rules that class should follow?
      2)linked list problem?
      how do find which is single linked list and which circular liked list,and what r the basic rules should strictly find the list?
      3)one class A
      {
      a{}
      }
      another class B
      {b{}
      }
      another class C
      {
      c c1=new c();
      // [using class C object , HOWcan call the method of cllass A ,class B }
      ///i do not answer .
      //what base those method call on Class C object?
      //
      You can go the articles section of this site and can find answers to ur questions urself.
      articles

      By d way we can do this to make a class immutable.....
      Code:
      make the fields private 
      initialize them in the constructor 
      do not provide setters methods 
      //u can declare class as final to prevent subclassing(it can defeat base class immutability)

      Comment

      • praveen2gupta
        New Member
        • May 2007
        • 200

        #4
        Originally posted by ysrinu15
        Hi all ,i have somedoubt ,
        1)how can say one class is an immutable,and what r basic rules that class should follow?
        2)linked list problem?
        how do find which is single linked list and which circular liked list,and what r the basic rules should strictly find the list?
        3)one class A
        {
        a{}
        }
        another class B
        {b{}
        }
        another class C
        {
        c c1=new c();
        // [using class C object , HOWcan call the method of cllass A ,class B }
        ///i do not answer .
        //what base those method call on Class C object?
        //

        Hi

        answers for your query.
        1. No Comment
        2. In simple linked list last liked list will be null. It will not be pointing to the address of any other list. This isssue is related to the Data Structure.
        3. For your query you should apply Inheritance in class B and class C. Once you understand the concepts of the inheritance you will get solutionn how to access methods of class B and class A

        Comment

        Working...