This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FAQ: Why do we specify the Coach interface in getBean()? | |
| Question | |
| Why do we specify the Coach interface in getBean()? | |
| For example: | |
| Coach theCoach = context.getBean("myCoach", Coach.class); | |
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public boolean isPalindrome(String str){ | |
| boolean result=false; | |
| if(str!=null && !str.equals("")){ | |
| int i=0; | |
| int j=str.length()-1; | |
| while(i<j){ | |
| if(str.charAt(i)!=str.charAt(j){ | |
| break; | |
| } | |
| i++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Complete this code or write your own from scratch | |
| import java.util.*; | |
| import java.io.*; | |
| class Solution{ | |
| public static void main(String []argh){ | |
| Scanner in = new Scanner(System.in); | |
| int n = in.nextInt(); | |
| HashMap<String,Integer> map=new HashMap<String,Integer>(); | |
| for(int i = 0; i < n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.*; | |
| import java.util.*; | |
| public class Solution { | |
| public static void main(String[] args) { | |
| /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ | |
| Scanner sc=new Scanner(System.in); | |
| int T=sc.nextInt(); | |
| for(int i=1;i<=T;i++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| int main(){ | |
| int n; | |
| int temp=0; | |
| int res=0; | |
| printf("Enter number"); | |
| scanf("%d",&n); | |
| temp=n%10; | |
| n=n/10; | |
| res+=temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| #include<string> | |
| using namespace std; | |
| bool isPalindrome(string str,int len); | |
| int main(){ | |
| string s; | |
| cin>>s; | |
| if(isPalindrome(s,s.length())){ | |
| cout<<"true"<<endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Client | |
| import java.io.DataInputStream; | |
| import java.io.DataOutputStream; | |
| import java.io.IOException; | |
| import java.net.Socket; | |
| import java.util.Scanner; | |
| import java.util.concurrent.ThreadLocalRandom; | |
| /* |