Latest Tutorials| Questions and Answers|Ask Questions?|Site Map


View Questions and Answers by Category


Have Programming Question? Ask it here!

saswat dash
a interview questioon
1 Answer(s)      4 years and 3 months ago
Posted in : Java Interview Questions

write a programme so the it can print each substring of a string like "saswat" is the string then it will print s,a,w,t,sa,swa,sta,as,aws,ats,sasw all posible sub string with out repeating

View Answers

December 13, 2010 at 3:46 PM

Hi Friend,

Try the following code:

import java.util.*;

class SubstringExample{
static Set set = new HashSet();
    public static void generate(String str){

        if (str.length() == 1){
        for (int i = 0; i < str.length(); i++){
            generate(str.substring(0,i) + str.substring(i+1));
    public static void main(String args[])
        Scanner scanner = new Scanner(;
        System.out.print("Enter a String: ");
        String st = scanner.nextLine();


Related Tutorials/Questions & Answers:
a interview questioon
a interview questioon  write a programme so the it can print each substring of a string like "saswat" is the string then it will print s,a,w,t,sa,swa,sta,as,aws,ats,sasw all posible sub string with out repeating   Hi
interview - Java Interview Questions
interview  kindly guide me some interview questions of Java
Interview Que
Interview Que  I want to Java Interview Questions   Please visit the following link: Java Interview Questions
Interview Question - Java Interview Questions
Interview Question  I need Interview Questions on Java,J2EE Pls help me
interview questions - Java Interview Questions
interview questions for Java  Hi Any one can u please post the interview point of questions.Warm Regards, Satish
Interview question
Interview question  what is mean by Dynamic class loading
Interview question - Java Interview Questions
Interview question   Hi Friends, Give me details abt synchronization in interview point of view. I mean ow to explain short and neat. Thanks
Interview Tips - Java Interview Questions
Interview Tips  Hi, I am looking for a job in java/j2ee.plz give me interview tips. i mean topics which i should be strong and how to prepare. Looking for a job 3.5yrs experience
tech. interview
tech. interview   java support round robin algo. if yes why? and if no why
Interview question - JSP-Interview Questions
Interview question   Hi Friend, Can we inherit interface in JSP. Thank u in advance
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
interview question - Java Interview Questions
interview question  hello i want technical interview question in current year   Hi Friend, Please visit the following links:
interview question - Servlet Interview Questions
interview question  What is Servlet? Need interview questions on Java... and HTTP Servlet.While going through an interview you could be asked for number... according to your experience.And for collection of Java Servlet Interview Question you
About interview questions
About interview questions   I want interview questions on IDE's Please send links
Java Interview Questions
Java Interview Questions  Hi, Can anyone tell the urls of Java Interview Questions on Thanks
struts interview Question - Struts
struts interview question and answer java  struts interview question and answer java
Jsp - Java Interview Questions
Need JSP Interview Questions  Hi, I need JSP interview questions.Thanks
Struts - Java Interview Questions
Struts Interview Questions  I need Java Struts Interview Questions and examples
java - Java Interview Questions
Helpful Java Interview questions   Need Helpful Java Interview questions
Client Interview
Client Interview  Hi, I am kumar i am having client round in polaries client is a BANK. how to face client interview. what are the expected questions from CITI
java interview - JSP-Interview Questions
java interview  what type of questions would be asked to a 3 years experience person in java? can anyone please provide list of topics or interview questions for 3 years experience in java
java interview question
java interview question  what is the usage of abstract class
interview path pdf
interview path pdf  Plz send me the paths of java core questions and answers pdfs or interview questions pdfs... the interview for any company... the following link: Interview Questions and their Answers
JAVA INTERVIEW QUES  what is meant by CTS in JAVA
Hi - Hibernate Interview Questions
Hi   please send me hibernate interview questions
java - Java Interview Questions
java  MNC now which modal question are asked in interview
Hibernate interview Questions
Hibernate interview Questions  Pl share hibernate interview..., but in that they have currently not updated interview questions. They have explain so many new technology with pictorial example and sample programs but interview question
java interview question
java interview question  when will we use abstraction or interface
struts interview question in ibm
struts interview question in ibm  what is the use of "format" attribute
java - Servlet Interview Questions
java  servlet interview questions  Hi friend, For Servlet interview Questions visit to : Thanks
Hibernate - Hibernate Interview Questions
hibernate interview questions and answers  Hi, Can anyone give me the best reference of hibernate interview questions and answers?Thanks in advance